Convert single MariaDB to a Galera Cluster - mysql

I have the next question that I don't know how to solve.
I currently have a server running mariadb version 10.1 on a Debian 9.8. This server is for test environments so it is not a real production environment.
Now I need to create a cluster using a gallery to have two nodes. I already have the second server mounted, but I don't know what are the steps to configure the Galera cluster of a node with databases already created and with information and with another node completely from scratch. What would be the steps and what should be done?

Related

MySQL read replica on Mac with Homebrew

I've recently started using AWS Aurora to take advantage of the improvements over standard MySQL. I have a REST API running that connects either to the main cluster endpoint, or the read endpoint if the request will only perform SELECTs. Obviously I want to test this locally so that I don't mark any routes as read only if they're not.
I installed mysql with Homebrew and have it running as a service. What I need to do now is have another mysql instance running on a different port, and then set up read replication between my original instance and the new one.
Does anyone have any idea how I go about this?

Is it possible to downgrade a AWS RDS from mysql 5.7 to lower version (say 5.6)

This is something i need to figure out, my company runs a number of prod RDS on AWS. Some of the mysql RDS run with 5.7 , i need to downgrade the mysql to 5.6 or 5.5 . Is this functionality provided by AWS.
Scenario: A mysql server already up and running with mysql version 5.7, Downgrade this to 5.6
-> If this is possible then what are the possible ways ?
-> How to do this ?
This is not something that AWS provides out of the box, however it can be solved with below 2 approaches depending on your database size and downtime that you can accept.
It might worth considering fixing application compatibility instead of downgrading DB which is more risky operation.
1. Dump, restore and switch method
Dump your currently running database with mysqldump utility. Start a new RDS instance with downgraded engine, load your dumped data into it. Switch your application to use RDS instance with downgraded engine.
2. Dump, restore, replicate & switch method
Dump your currently running database with mysqldump utility. Start a new RDS instance with downgraded MySQL engine, load your dumped data into it.
Set the new, downgraded DB instance as read replica of your old DB instance using mysql.rds_set_external_master and then start replication using mysql.rds_start_replication. Stop writes to your original DB, once the read replica catches up (you must monitor replication lag), run mysql.rds_reset_external_master which will promote your downgraded instance and turn off replication. Point your application to the downgraded RDS DB instance.
Method 2 will shorten your downtime to minimum, but is a bit more complex to execute. Here is a command reference to get familiar with to help you succeed: MySQL on Amazon RDS SQL Reference
You will find a great amount of examples in RDS documentation also - Importing and Exporting Data From a MySQL DB Instance:

AWS - Creating Read Replica of a Read Replica

We are migrating our MySql instance from version 5.5 in US to 5.6 in Sydney.
To reduce downtime I want to do following:
Create Readonly Replica in US
Upgrade it to 5.6
Enable automated Backup as it's required to replicate the instance
PROBLEM: When I'm trying to create a replica of a replica(selecting Sydney as destination region) I get this: "The source DB instance specified needs to be non read replica"
If I understand this http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html correctly it should be perfectly fine for me to create a replica of a replica, however I'm running out of ideas why it doesn't let me... Should I make it non-readonly?
UPDATE: It looks like you can create a Replica(5.6) of a Read Replica(5.6) in the same region, however I still have no luck creating a readReplica from a readReplica in another region.
I think you are missing the step of Promoting the Read Replica to fully functional stand-alone RDS instance.
Once you are through this step, you can then enable the Backups and Snapshots.
Excerpt From AWS Blog
Upgrade Support
Today we are enhancing Amazon RDS with the ability to upgrade your
MySQL DB Instances from version 5.5 to the latest release in the 5.6
series that's available on RDS.
To upgrade your existing instances, create a new Read Replica, upgrade it to MySQL 5.6, and once it has caught up to your existing
master, promote it to be the new master. You can initiate and
monitor each of these steps from the AWS Management Console. Refer to
the Upgrading from MySQL 5.5 to MySQL 5.6 section of the Amazon RDS
User Guide to learn more.
References : MySQL 5.5 to MySQL 5.6 Upgrade Support for Amazon RDS

MySQL mirroring on EC2

I'm running two MySQL server one on production and one on staging, both are EC2 Instance.
The same way i have two MySQL RDS Instances parallel to the production and staging.
Here want i wanted to do.
I would like to mirror the production database to the development server every few hours,
for 1. backup, 2. to run new features against the latest database changes.
I didn't find much information regarding this issue, can anyone help?
Thanks.
Additional information:
i'm running nginx on linux server, with php backend.
If you are running on RDS, you have two options.
Snapshot and restore your instance. You can automate this, but the time it make take more time the larger the DB is. Your endpoint will probably change too.
Dump the database from production, reload into development.

MySQL Cluster + Manager and NDB/J

I've been trying to setup a MySQL Cluster for a few days using the MySQL Cluster Manager on 3 Ubuntu nodes (3 identical VM instances with 1GB RAM each).
I've followed the video on MySQL Cluster Manager on the MySQL site. There's not much other documentation/tutorials on it (probably because it's a commercial product).
I start the cluster and show the status, but the mysqld nodes never start, they just remain as "added". If I install mysql-server using "sudo apt-get install mysql-server" then I get the normal local server running and the nodes register as "started", but I can't see how to connect to the cluster rather than the individual MySQL servers running on the mysqld nodes.
I'm also at a loss as to how the Java connector for MySQL Cluster is organised, it appears that there are multiple libraries so I don't even know which library I need or how to get them (some are created when compiling MySQL Cluster???). Could someone please explain how the connectors work to interact with NDB from Java and how to get them?
Thanks for any answers.
First of all, the official documentation for MySQL Cluster Manager can be found by navigating to the Cluster documentation on dev.mysql.com (called "MySQL Cluster Manager"). You are correct that MySQL Cluster Manager is commercial software although MySQL Cluster itself is available under a commercial or GPL license.
It sounds as though you've already configured the agents and have them running and so if you want to get a Cluster up and running quickly then refer to this simple worked example of using MySQL Cluster Manager
In terms of understanding why the MySQL Servers (mysqlds) are not starting up, there aren't many clues in your question and so we need to narrow it down (one reason could be if you had multiple mysqlds defined on the same host that are trying to use the default port (3306)).
To check what the manager has been doing, take a look in the file called mysql-cluster-manager.log. You can adjust the level of logging using the cluster manager configuration file.
To see what MySQL Cluster itself thinks has happened, check the directories storing the cluster data files (if you haven't over-written the defaults then this would be under /clusters/ and then you'll see a directory for each node in the cluster). The first one to check is ndb__cluster.log and other logs that you'll find in the "data" sub-directory of the id associated with the ndb_mgmd node. There will also be per-node log files so also check the mysqld_out.err and mysqld_out.log files stored in the data directory associated with mysqld node-ids.
Most important point is do not use the mysqld that gets installed with "sudo apt-get install mysql-server" as this version will not be compatible with MySQL Cluster - always use the binaries that come with the MySQL Cluster tar ball (or if using Cluster Manager that should be transparent to you anyway.
Note that if you want to get MySQL Cluster up and running on a single host without MySQL Cluster Manager then refer to the quick-start guide located on the MySQL Cluster download site (on mysql.com rather than e-Delivery).
For the java access, try out this MySQL Cluster ClusterJ tutorial.