maria_ha_maxscale

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
maria_ha_maxscale [2020/10/23 19:40] andonovjmaria_ha_maxscale [2020/10/24 18:17] (current) – [Testing the Environment] andonovj
Line 18: Line 18:
   * node4   * node4
  
-=====Setting up===== +=====Configuration===== 
-To set up we have to install the packages and configure the repositories. Do that on all nodes in the cluster. In our case on all 4:+The whole processes will go as follows:
  
 +  - Install MariaDB and Maxscale on all nodes
 +  - Configure Galera Cluster
 +  - Configure Maxscale
 +  - Feature tests
  
 +====Setup Repo====
 <Code:bash|Repo Config> <Code:bash|Repo Config>
 [root@node1 ~]#  curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash [root@node1 ~]#  curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
Line 146: Line 151:
 [root@node4 ~]# service mariadb start [root@node4 ~]# service mariadb start
 Redirecting to /bin/systemctl start mariadb.service Redirecting to /bin/systemctl start mariadb.service
-[root@node4 ~]# service mariadb status 
-Redirecting to /bin/systemctl status mariadb.service 
-● mariadb.service - MariaDB 10.5.6 database server 
-   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) 
-  Drop-In: /etc/systemd/system/mariadb.service.d 
-           └─migrated-from-my.cnf-settings.conf 
-   Active: active (running) since Thu 2020-10-22 17:13:11 UTC; 5s ago 
-     Docs: man:mariadbd(8) 
-           https://mariadb.com/kb/en/library/systemd/ 
-  Process: 23170 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) 
-  Process: 22993 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS) 
-  Process: 22991 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) 
- Main PID: 23042 (mariadbd) 
-   Status: "Taking your SQL requests now..." 
-   CGroup: /system.slice/mariadb.service 
-           └─23042 /usr/sbin/mariadbd --wsrep_start_position=00000000-0000-0000-0000-000000000000:2 
- 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 0 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 5) 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 2 [Note] WSREP: Server node4 synced with group 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 2 [Note] WSREP: Server status change joined -> synced 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 2 [Note] WSREP: Synchronized with group, ready for connections 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification. 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 0 [Note] Reading of all Master_info entries succeeded 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 0 [Note] Added new Master_info '' to hash table 
-Oct 22 17:13:11 node4 mariadbd[23042]: 2020-10-22 17:13:11 0 [Note] /usr/sbin/mariadbd: ready for connections. 
-Oct 22 17:13:11 node4 mariadbd[23042]: Version: '10.5.6-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server 
-Oct 22 17:13:11 node4 systemd[1]: Started MariaDB 10.5.6 database server. 
 </Code> </Code>
  
 After that, we can see that the members of the cluster increased: After that, we can see that the members of the cluster increased:
- 
  
 <Code:bash|Cluster members> <Code:bash|Cluster members>
Line 190: Line 167:
 </Code> </Code>
  
-====Setup Users for MaxScale====+====Prepare users for MaxScale====
 First we need to set up a user that MariaDB MaxScale use to attach to the cluster to get authentication data. On 192.168.10.182, using the MariaDB command line as the database root user: First we need to set up a user that MariaDB MaxScale use to attach to the cluster to get authentication data. On 192.168.10.182, using the MariaDB command line as the database root user:
  
Line 220: Line 197:
 </Code> </Code>
  
-====Configure MaxScale====+====Setup MaxScale====
 The configuration of MaxScale is stored in: "/etc/maxscale.cnf" The configuration of MaxScale is stored in: "/etc/maxscale.cnf"
  
 <Code:bash|Maxscale Config> <Code:bash|Maxscale Config>
-[root@node1 ~]# cat /etc/maxscale.cnf 
 # Globals # Globals
 [maxscale] [maxscale]
 threads=1 threads=1
-admin_secure_gui=false +admin_secure_gui=false                 <- We don't have SSL, we aren't so rich. 
-admin_host=192.168.10.101 +admin_host=192.168.10.101              <- Defining NIC interface instead of localhst: 127.0.0.1 
-admin_port=8989+admin_port=8989                        <- Default port.
  
 # Servers # Servers
Line 274: Line 250:
 address=192.168.10.101 address=192.168.10.101
 port=3306 port=3306
-[root@node1 ~]# 
 </Code> </Code>
 +
 +It took my REALLY LONG TIME, to figure out the configurations as they change from release to release. Like every open source software....
 +
 +After that we can start the maxscale:
 +
 +<Code:bash|Start MaxScale>
 +[root@node1 maxscale]# service maxscale start
 +Redirecting to /bin/systemctl start maxscale.service
 +</Code>
 +
 +=====Testing the Environment====
 +In our test:
 +  - We will connect to the listener on the maxscale server
 +  - Check the server (e.g. server 3)
 +  - Shutdown the MariaDB on the server from step 2)
 +  - Check the server from our connection (we should be moved)
 +
 +
 +<Code:bash|Session on node1>
 +[root@node1 maxscale]# mysql -h 192.168.10.101 -P 3306 -u myuser -p
 +Enter password:
 +Welcome to the MariaDB monitor.  Commands end with ; or \g.
 +Your MariaDB connection id is 1
 +Server version: 10.5.6-MariaDB MariaDB Server
 +
 +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 +
 +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 +
 +MariaDB [(none)]> show variables like 'hostname';
 ++---------------+-------+
 +| Variable_name | Value |
 ++---------------+-------+
 +| hostname      | node3 |
 ++---------------+-------+
 +</Code>
 +
 +Now from the session, connected on node3, shutdown the MariaDB:
 +
 +<Code:bash|Session on node 3>
 +[root@node3 ~]# systemctl stop mariadb.service
 +</Code>
 +
 +Once we shut down the instance, our session should be moved to running server, so let's check it.
 +From the first session, without reconnected, re-query the same data.
 +
 +<Code:bash|Session on node1>
 +MariaDB [(none)]> show variables like 'hostname';
 ++---------------+-------+
 +| Variable_name | Value |
 ++---------------+-------+
 +| hostname      | node4 |
 ++---------------+-------+
 +1 row in set (0.001 sec)
 +</Code>
 +
 +After, we can also connect to the GUI, which should listen on: http://192.168.10.101:8989
 +
 +===GUI===
 +{{ :mariadbmaxscaleentry.jpg?600 |}}
 +
 +The default credentials are:
 +Username: admin
 +Password: mariadb
 +
 +{{ :mariadbmaxscaleoverview.jpg?800 |}}
 +
  • maria_ha_maxscale.1603482026.txt.gz
  • Last modified: 2020/10/23 19:40
  • by andonovj