MySQL on Amazon? - mysql

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.

Related

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

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.

aws and elb function with mysql database

I want to ask if I have 2 identical ec2 instances each with MySQL. If i add a load balancer on the front of the ec2 instances, the databases of ec2 will have the same data or every database will have the data that process by a request? In other words with elb the databases will be synchronized somehow or every database will have different information?
Many thanks!
I would recommend using Amazon's RDS. It is easier to setup and you do not need to manage the cluster. If you really want to manage the boxes yourself I would look at configuring Galera
Here is a tutorial from Digital Ocean, but it would work on AWS as well.
Hope I don't think two EC2 instances must have same data in MySQL DB. ELB will send request to any EC2 instances so data will update in one instance and not in another instance anyway MySQL DB are not synchronized between instances.
I recommend you to use Amazon RDS service which is relational database and it offers MySQL, MSSQL, PostgreSQL, Oracle and Amazon Aurora. You can use any database and enable high availability for good performance.

Connecting Securely to MySQL Database on an Amazon EC2 instance from another EC2 instance

I'd like to connect to a mysql database on an AWS EC2 instance from another EC2 instance, but I don't want this mysql database to be accessible from other IP addresses. Changing the bind-address in my.conf to 0.0.0.0 allows everybody to access it, and I don't feel comfortable doing this.
What's the best approach on AWS to configure this in a secure way?
It is easy to do the above. Lets say EC2-1 is your instance and EC2-2 is your MYSQL instance with Security group 1 for EC2-1 and Security group 2 for EC2-2. Add below rule in your Security Group 2. So you can only connect to MYSQL running on EC2-2 from EC2-1 and no body else can connect.

need to connect my same apps with one database

i have 3 servers for three applications on aws ec2 using MySql database,
now each of the application is having amember that is client subscription app,
it connects with sql databse that is created in each instance
so in this way every amamber app is having diffrent database in each server,
now we are working with a device ROKU we need to pass the XML attributes from amember to it
to varify the user so he can watch online streaming tv.
the objective
now i need to make one database that will be connected with each server using amember
so each server access one database .
Options
my options are aws RDS ,dynamoDb
Now can anyone put me in the right direction, for that.
in simple Words
need to connect my multiple apps (same app) with one database
HELLLLP
If you need to connect to a mysql database, DynamoDB is not the answer. It isn't a mysql database.
RDS is a mysql database. It connects like any other mysql database. You haven't mentioned what language[s] you are using, however. Googling "connect to mysql with [language]" should help.
I think it would be best to stick with relational databases such as MySQL.
Amazon RDS is a managed MySQL solution, but you don't have to use it for your needs.
You can use one of your EC2 instances or a new EC2 instance as the central DB and connect all the other servers to it for quires. There are pros and cons for choosing RDS over your own SQL server. If you have any questions there, feel free to edit your question and add them.
EDIT according to comment
In order to connect your application with the local MySQL. Your are probably using a connection string that points to either "localhost" or "127.0.0.1"... That is the IP of your local machine. You will have to change it to the remote IP of the machine where the DB is stored remotely.

Create MySQL server on a subdomain

Is it possible to split the instance of a dedicated box to serve mySQL on a seperate host. Example:
www.site.com - ip 192.1.1.1
mysql1.site.com - ip 192.1.1.2
and then I can host mySQL on this seperate subdomain server even do:
$dbhost="mysql1.site.com";
or
$dbhost="mysql1.site.com:3001";
// i dont know how to make ports
I have seen people do this, in once instance have
mysql1.site.com
mysql2.site.com
mysql3.site.com
where mysql1 is copied per 30seconds to 2 and 3, and if 1 fails, 2 and 3 are ready for backup..
Yes, it is fully possible. You have two servers: one runs application, the other runs MySql database. Your application connects to the server running the database. No big deal.
For example on Amazon AWS the usual configuration is to run your application on Amazon EC2 server and your database on Amazon RDS server.
if you need to sandbox mysql on one host then head over to http://mysqlsandbox.net/ not suited for production though so if you have one box and need multiple installations you can look in to virtualization as well
Yes. You can have your mysqld on a different server than the httpd. And, yes, you can set up database replication.