Externalize properties in Kafka Connect - openshift

I want to externalize DB connection username and password in Kafka connect, the application is supposed to fetch username and password from OpenShift Secret config. Can someone guide how to do it please.

By default, Connect can only externalize secrets to files.
You would need to write your own ConfigProvdier implementation to have different functionality.
Otherwise you could mount a volume

Related

How to setup mysql develper for PCF mySQL database to manage it

I am trying to understand PCF concepts and thinking that once i am done with creating mysql services in PCF, how i can manage that database like creating tables and maintaining that table just like we do in pur traditional environment using mySqldeveoper. I came across one service like PivotalMySQLWeb and tried but didnt liked it much. So if somehow i can get connection details of mysql service , i can use that to connect using sql developer.
The links #khalid mentioned are definitely good.
http://docs.pivotal.io/p-mysql/2-0/use.html
https://github.com/andreasf/cf-mysql-plugin#usage
More generally, you can use an SSH tunnel to access any service, not just MySQL. This also allows you to use whatever tool you would like to access the service.
This is documented here, but if for some reason that goes away here are the steps.
Create your target service instance, if you don't have one already.
Push an app, any app. It really doesn't matter, it can be a hello world app. The app doesn't even need to use the service. We just need something to connect to.
Either Bind the service from #1 to the app in #2 or create a service key using the service from #1. If you bind to the app, run cf env <app> or if you use a service key run cf service-key MY-DB EXTERNAL-ACCESS-KEY and either one will give you your service credentials.
Run cf ssh -L 63306:us-cdbr-iron-east-01.p-mysql.net:3306 YOUR-HOST-APP, where 63306 is the local port you'll connect to on your machine and us-cdbr-iron-east-01.p-mysql.net:3306 are the host and port from the credentials in step #3.
The tunnel is now up, use whatever client you'd like to connect to your service. For example: mysql -u b5136e448be920 -h localhost -p -D ad_b2fca6t49704585d -P 63306, where b5136e448be920 and ad_b2fca6t49704585d are the username and database name from step #3 and 63306 is the local port you picked from step #4.
Additionally, if you want to connect aws-rds-mysql (instantiated from Pivotal Cloud Foundry) from IntelliJ, you can use the DB-Navigator Plugin (https://plugins.jetbrains.com/plugin/1800-database-navigator) inside IntelliJ, through which, database manipulation can be performed.
After creating the ssh tunnel $ cf ssh -L 63306:<DB_HOSTNAME>:3306 YOUR-HOST-APP (as also mentioned in https://docs.pivotal.io/pivotalcf/2-4/devguide/deploy-apps/ssh-services.html),
Go to DB Navigator plugin and click on custom under new connection.
Enter the URL as: jdbc:mysql://:password>#localhost:63306/<database_name>
The following thread might be helpful for you as well How do I connect to my MySQL service on Pivotal Cloud Foundry (PCF) via MySQL Workbench or CLI or MySQLWeb Database Management App?

Outsystems: configuring a connection to access a MySQL database

I'm using Outsystems Service Studio to develop a web application. I need to configure a connection to access a local server database. I get "Connection String test failed: Unable to connect to any of the specified MySQL hosts." I just figured out I can't connect using "localhost", because the Outsystems server is not local, but I'm not able to find a solution. what is wrong? Other details:
MySQL Server is up and running
I selected MySQL in DBMS
Inserted my schema name
Inserted the username (with all privileges granted)
Inserted the user password
Tried both basic and advanced configuration. I inserted j"dbc:mysql://127.0.0.1:3306/mydb?user=outsystems2" as connection string parameters and I get "Connection String test failed: Keyword not supported.Parameter name: mysql://127.0.0.1:3306/mydb?user". I know this connection string can't work , but I'm not able to find a functioning one. I've read many guides about this configuration, but no solution was found. Thank you all for your time and help, feel free to ask for more details
Luciano,
Is your OutSystems environment on-premises or in the cloud? Either way, you need to make sure that this server is able to reach - it as connectivity - to your MySQL database server. Using localhost or 127.0.0.1 is pretty much the same thing as this is an address for the machine where the request is running, which is, in this case, the OutSystems server. Do you have the MySQL database on your local machine? This is not a good approach as you will need to have an address that won't change otherwise the connection won't be stable and you'd have to reconfigure it all the time.
Regards

Unable to connect to local MySQL DB using Laravel

I have a local database that I can connect to no problem using straight php
However, when I use the same settings in Laravel, I get an access denied error message
I checked stackoverflow for this type of error and most cases is solved by using 127.0.0.1. I made sure to try both 127.0.0.1 and localhost whenever asked for host/server.
Also, I made sure root had sufficient privileges
Here are my configuration settings, I tried to use different accounts, other than root, and also changing 127.0.0.1 to localhost (and the opposite)
database.php file
.env file
Hoping to learn this framework, I've heard great things. Appreciate any help
Sounds like you are trying the connection both with the script and laravel from a different Server like homestead.
Normally there are restrictions that you can't connect from remote (i.e. from a VM like homestead) to a certain server (i.e. localhost) with the root user.
Possible Solutions:
1. Create another user with the relevant permissions on mysql and connect with that one.
2. Look in the web for how to allow remote connections
3. Go the laravel way and use the homestead DB inside of the VM
First, are you sure you typed the password correctly?
Second, are you using the homestead virtual box? If yes, the default user is "homestead" and the pass is "secret" without quotes of course. Try putting that in the .env file

ERROR 2003 (HY000): Can't connect to MySQL server on AWS RDS

I created an external user with '%' hostname to allow remote access. I get the following error while connecting the local MySQL to remote AWS RDS:
ERROR 2003 (HY000): Can't connect to MySQL server on 'instance.cvxqy8tbi2bk.us-east-1.rds.amazonaws.com' (110).
I tried commenting the #bind-address = localhost but no solution.
Any pointers for this?
Anyone encountering this issue today should check out this YouTube video at around 6:05:
AWS RDS MySQL Database Setup | Step by Step Tutorial.
In a nutshell, you have to create a new inbound security rule to allow an external connection.
I had the same problem.
this solution: When you create database
in the Virtual private cloud (VPC), please choose "Create new VPC"
in the VPC security group, please choose "create new", don't choose "choose existing"
You should diagnose connection to ANY Mysql/Mariadb/RDS connection before changing any server parameter.
Always use this to check connection.
mysql -u username -p -h your_rds_instance_name
If connection fail, then check network connection(can you ping the instance name from your local system? ), i.e. firewall access, RDS Subnet rules, security groups rules. If the topics too advance for your, then follow the usual quickstart guidelines and tutorial.
"I tried commenting the #bind-address = localhost but no solution. "
No you cannot just comment it out.
If you want to allow remote connections to the MySQL database then you need to bind to your network adapter and not localhost / the loopback adapter.
So you need to get your server IP then:
bind-address = the.srv.ip.is
This is a better question for Server Fault ;)
I faced the same issue, turns out that I had made the database private to the VPC, meaning only instances in the vpc would be allowed to access the databse,
so either make the DB public or try to access the database using an instance in your VPC.
change settings to Publicly accessible. by clicking Modify option

How to connect mysql(based on EC2 instance) in Visual studio?

I am a totally new on Amazon EC2 and I have just created an AMI instance (Linux).
I've installed php, apache and mysql in that instance as well and I have a question about it.
There is a .pem file which is used as a password when i connect to the instance.
If i want to connect to the instance through Visual studio, How can i get the password?
I mean, In an API function, to connect to database requires the password of the server. However, EC2 instance has .pem file as a password so how could i retrieve .pem file as a real password? (I want to make a program in VS and i need to connect to MySQL which is in the EC2 instance) well, basically, Is it possible to retrieve the password #.#????
Thanks in advance indeed!
Visual Studio Integration
One way to do it is to download the Connector/Net driver for MySQL and install it. Then in your Web.config file add a connection string similar to the below to connect to the database. Then setup your models to reflect the tables in your MySQL database. Create a DbContext class with the same name as the connection string name in your Web.config file. Then you can work with it as normal.
<connectionStrings>
<add name="SuperSmartDB" connectionString="server=ec2-50-34-34-157.compute-1.amazonaws.com;user=root;database=superrdb;port=3306;password=nunya123;" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
If new to Visual Studio
Once all your models are created you can create a new controller. When creating the controller: set model class to the table you want to work with and the data context class to the context that matches your connection sting in Web.config. Select to have the CRUD create via Template. Doing so will create the basic Create, Read, Update, and Delete controller actions and views for you.
You don't need .pem file to connect to database through VS. .pem file is needed when you try to SSH into the instance. For connecting to MySQl DB, MySQL host,user and password are required.