How to preserve the configurations of ProxySQL after restarting the EC2 instance? - mysql

I've followed the tutorial here and set up a ProxySQL v2.0.2 service on an Ubuntu AWS EC2 instance.
One thing that troubles me is that the configurations of ProxySQL are gone after the EC2 instance restarts.
For example, before the EC2 instance restarted, SELECT * FROM mysql_servers; returns the backend databases I've added to ProxySQL. But after the EC2 restarted, SELECT * FROM mysql_servers; returns an empty set. And I must re-configure ProxySQL to allow the clients to connect to databases through ProxySQL.
How can I preserve the ProxySQL configurations after the EC2 instance restarts?
Why can't SAVE MYSQL VARIABLES TO DISK; command preserve the configurations?
I configure ProxySQL using the admin interface.
I've tried adding servers in mysql_users section of /etc/proxysql.cnf file. But it seems that it has no effect at all. This is strange.

According to this document, I should use SAVE MYSQL SERVERS TO DISK to save the mysql_servers configuration to the disk.
SAVE MYSQL VARIABLES TO DISK; is used to save other variables to the disk.

Related

Why is my MySQL Database on AWS not accessible?

I cannot reach my MySQL Database instance I created on AWS.
What I tried was to set the public access of the Database to "Publicly accessible" here:
Also I tried to set Inbound/Outbound rules for the MySQL port here:
Honestly I think using "All" ports would include 3306 too. Anyways, I tried it this way because yet it didn't work. I cannot connect to the database via MySQL Workbench, nor can I use a ping request on the given endpoint.
I would be glad if someone here has an idea what I could try else.
This will not work if you have deployed it in a private subnet which has no internet access.
Another possibility is that there is ACLs that is stopping the traffic. Security group only touch the RDS instance, the ACLs control traffic in the entire subnet.
Here is a dev AWS tutorial that creates a web application that stores data in MySQL running on the cloud. It will show you how to setup the database and the inbound rules. Once you do, you can store data or query data from MySQL. Likewise, you can use MySQL Workbench to interact with MySQL on the cloud.
AWS RDS Tutorial

Setting up master/slave databases on same server?

I'm looking to have a master and slave DB on the same server, both in an Amazon RDS instance. Is this possible? I'm using MySQL Workbench to access it and am a little confused with the instructions I have seen so far.
"On the same server" is not possible with Amazon RDS for MySQL, because RDS is a managed service. Amazon provides, configures, and has exclusive access to the actual server where an RDS instance is running... you, the user, do not have direct (shell) access to that machine, so you can't do the kind of customization of configuration that running a master and slave on the same server would require.
Other being not possibile since RDS is a managed MySQL (you don't have SSH access or SUPER privileges) it would be also not that useful:
You make a slave replica for scaling out or for backup/failover, on the same machine it doens't make sense

Enforce SSH to mysql

I have setup a linux server in Amazon Ec2 with a mysql db in RDS.
Connect from mysql workbench to RDS is going fine with (TCP/IP) or (TCP/IP with SSH).
My question is, how to enforce all connections to RDS must going through linux server? I want to enforce this behaviour because it gives an extra layer of security.
Want to enforce this
Client -> EC2 Linux Server -> RDS
Want to stop this
Client -> RDS
My Ec2 Configuration
My RDS Configuration
untested
Try:
[client]
protocol=tcp
host=<ip address of DB server>
in your my.cnf file. Where the host can only be accessed via ssh.
After playing with it some time, I finally got the desired result by setting the security group id as parameter in the source connection setting. Thanks all.

How does one see what data is stored in the RDS database?

Running our app on Amazon RDS. How does one review / inspect data in the database? For example, how can I get a list of articles?
My app is running on Ruby on Rails and on Heroku. One method I thought of, is by running the Heroku console command.
Is there a better way to see what data is stored in the RDS database?
I use MySQL Workbench to view data, run queries, and so on. It connects right up to the Amazon RDS MySQL instance using the regular MySQL settings.
Updated:
Be sure to add the ip address of the computer for which you're connecting to the RDS instance to the access list in RDS. IIRC, by default RDS instances will only accept connections from within AWS.
I was using SequelPro but they don't support ssl. Amazon RDS says something to the effect of having to use SSH to connect your EC2 to your RDS.
This is essentially what was done in the following tutorial which uses MySQL Workbench: http://thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/
I had also been using SequelPro before but this tutorial is very clear and I was up and running on MySQL Workbench in just a few minutes.

MySQL on Amazon?

I'd like to have 20 different Amazon EC2 instances that read and write from the same shared location. Is it at all possible?
Also, is it possible to have an instance of MySQL that will be accessible from all 20 Amazon EC2 instances?
You could use Amazon's RDS which offers a managed MySql service which all your instances could access. Otherwise yes of course it is possible to have a single MySql instance running which all your other instances can access in which case you will need to configure MySql to allow remote connections and open the EC2 port (3306 by default) on the database server.
The whole idea of a database server is to provide a shared data repository. If you can get to your single MySQL instance over the network, you shouldn't have a problem.