Вот моя установка:
- 4 VMs (running on CentOS 7)
- VM1 with mariadb-client and maxscale for load balancing (I have tried haproxy, results are the same). httpd and php (I am testing this with WordPress installation)
- VM2, VM3, VM4 с mariadb-сервером, galera, rsync
- Software installation
- adding repository "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash" on all 4 VMs
- установка MariaDB-сервера на ВМ2, ВМ3, ВМ4 (сюда входит галера и весь необходимый софт)
- установка maxscale и клиента MariaDB на VM1
- Editing config files
- on VM2, VM3, VM4 I have added: https://gist.github.com/yarko686/5adb7b24784c4c3c24a526519623d930 to /etc/my.cnf.d/server.cnf
- на VM1 я добавил следующие строки в /etc/maxscale.cnf https://gist.github.com/a67e94afaa4ecc57ccb985d897ee3e87.git
- Staring the cluster
- on VM2 I have executed galera_new_cluster
- на VM3 и VM4 я выполнил systemctl start mariadb
- Checking the cluster
- on VM2 I am accessing mysql using mysql -u root then executing: show global status like 'wsrep_cluster_size';
- Я получаю этот вывод https://gist.github.com/yarko686/a63c925b3275d239f38d50f0651e45ef, это означает, что в кластере 3 машины
- Creating maxscale user and wordpress users
- Login to MySQL CLI on VM2 using mysql -u root and executing the following commands https://gist.github.com/yarko686/950ea62f79638a6f293c28b99dd19f7b
- для пользователя WordPress я использую те же команды, кроме .. В этих случаях вместо этого я использую wordpress_db.*.
- The main issue.
- after importing WordPress database, it is properly created only on VM2 only. On VM3 and VM4 the database and tables are created, however, for some reason they are empty.
- Если я получаю доступ к базе данных wordpress через MySQL CLI, используя своего пользователя wordpress, и создаю новую таблицу с некоторыми данными, она реплицируется, но когда я добавляю пользователя в свою таблицу wp_users (или добавляю пользователя через wp-admin), она не реплицируется. Запись создается только на VM2, а не на VM3 и VM4.