In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
installation preparation
Package: mariadb-galera-10.0.15-linux-x86_64.tar.gz
test environment
ip hostname Remarks
192.168.1.111 test1 Node 1
192.168.1.112 test2 node 2
192.168.1.113 test3 arbitration node
1, close selinux:
Set selinux of/etc/sysconfig/selinux to disabled
2, modify or close the firewall
Modify Firewall:
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4444 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4567 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4568 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4569 -j ACCEPT
service iptables restart
Close the firewall:
systemctl stop firewalld service iptables stop
Install lsof (without it you may not be able to start the database)
yum install -y lsof
3. Install database mariadb
Download Package: mariadb-galera-10.0.15-linux-x86_64.tar.gz
decompression
tar zxf mariadb-galera-10.0.15-linux-x86_64.tar.gz
modify the address
mv mariadb-galera-10.0.15-linux-x86_64 /usr/local/mysql
Creating MySQL Users
groupadd mysql
useradd -g mysql mysql
chmod mysql:mysql -Rf /usr/local/mysql
chmod +x -Rf /usr/local/mysql
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
initialize the database
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
Add mysql to boot
chkconfig mysql on
start the MySQL
service mysqld start
Set mysql command
vi /etc/profile
Add export PATH=/usr/local/mysql/bin:$PATH
source /etc/profile
Set mysql password
mysqladmin -u root passwd '123456'
Practical root login
mysql -uroot -p123456
4. Build galera cluster
Note: mariadb-galera-10.0.15-linux-x86_64.tar.gz already has galera plug-in, you can also download and install galera installation, the software version in the cluster must be consistent
Start 111 first, then start 112, and finally join arbitration (start order is different, wsrep_cluster_address configuration in wsrep.cnf file is slightly different)
Install galera
yum install -y galera
Find the wsrep.cnf file
find / -name wsrep.cnf
Results:
find : .... /usr/local/mysql/support-files/wsrep.cnf
Copy this file to etc/
cp /usr/local/mysql/support-files/wsrep.cnf /etc/my.cnf.d/
modify the configuration file
vi /etc/my.cnf.d/wsrep.cnf
wsrep_cluster_name="my_wsrep_cluster"
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address=gcomm://
#The first node starts, the address above is empty, the later nodes join the cluster, and the IP address of the cluster should be added after gcomm. If it is not the default port 4567, the address format is ip: port.
#wsrep_cluster_address=gcomm://192.168.1.112
wsrep_node_name='localhost'
wsrep_node_address=192.168.1.111
wsrep_sst_method=rsync
Modify/etc/my.cnf
vim /etc/my.cnf
Add a statement! includedir /etc/my.cnf.d/
Comment out statement #binlog_format=mixed
server-id = 1
Configure galera in 112, server-id is 2, modify node address and cluster gcomm address
wsrep_cluster_address=gcomm://192.168.1.111
wsrep_node_name='localhost'
wsrep_node_address=192.168.1.112
server-id = 2
5. Set the database access account and permissions
mysql -u root -p123456
>grant all privileges on *.* to 'root'@'localhost' identified by '123456';
>grant all privileges on *.* to 'root'@'%' identified by '123456';
>flush privileges;
Modify the wsrep.cnf file accordingly
vim /etc/my.cnf.d/wsrep.cnf
wsrep_sst_auth=root:
6. Start cluster
Start 111 first, then start 112, and finally add 113 arbitration node
Run service mysqld start on 111 and 112
Enforcement on 113 arbitration
(When starting the arbitration node, you may encounter a missing libssl.so.6 file, and you need to add a soft connection with ln)
garbd -a "gcomm://192.168.1.111:4567,192.168.1.112:4567 -g my_wsrep_cluster -d
Modify the listening port of the arbitration node to prevent conflicts with the database
garbd -a "gcomm://192.168.1.111:4567,192.168.1.112:4567? gmcast.listen_addr=tcp://0.0.0.0:4569&pc.wait_prim=no" -g my_wsrep_cluster -d
113 After executing the command, use ps -ef| grep garbd View progress
7. View cluster status
113 After executing the command, use ps -ef| grep garbd View progress
View status in database on 111 and 112
mysql -uroot -p123456
>show status like 'wsrep%';
Check wsrep_incoming_addresses 192.168.1.111:3306,192.168.1.112:3306,
wsrep_cluster_size 3
Complete cluster
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.