Mariadb-galera-10.0.19oncentos6.5

Source: Internet
Author: User
Tags rsync

Mariadb-galera-10.0.19oncentos6.5

**************************************** ************************************* 0. use Cases ************************************** **************************************** database software: mariadb-galera-10.0.19-linux-x86_64.tar.gz cluster management: galera-25.3.5-1.rhel6.x86_64.rpm node Sync Mode (xtrabackup, rsync): percona-xtrabackup-2.2.8-5059.el6.x86_64.rpm node sync using sockt: socat-2.0.0-b7.tar.gz installed galera is to get/usr/lib64/galera/lib1_a_smm.so; xtrabackup is installed to configure the synchronization mode xtrabackup, which is used for node data synchronization. socat is installed because the socket mode is used for end-to-end data exchange. Database node: 192.168.50.10 db01 db01.mysql. com192.168.50.20 db02 db02.mysql. com192.168.50.30 db03 db03.mysql.com ************************************* **************************************** * 1. system installation ************************************** **************************************** -------- 1. desktop installation, select the following two customized packages, others choose base systemlegacy unix compatibility (rsh telnet ksh tftp) Customized topslegacy x window system compatibility (xorg-x11-xdm) ------- 2 configure yum source cd/etc/yum. repos. dmv CentOS-Base.repo CentOS-Base.repo.oldwget http://mirrors.163.com/.help/CentOS6-Base-163.repoyum Makecache checks updatable rpm packages # yum check-update updates all rpm packages # yum update --- 3. disable firewall and selinuxchkconfig -- level 123456 iptables offservice iptables stop/usr/sbin/sestatus-v | grep "SELinux status" vi/etc/selinux/configSELINUX = disabled --- 4. modify hosts # vi/etc/hosts192.168.50.10 db01 db01.mysql on each node. com192.168.50.20 db02 db02.mysql. com192.168.50.30 db03 db03.mysql.com --- 4. rzyum install lrzsz-y **************************** **************************************** * ********** 2. for mysql installation ************************************* **************************************** * 1: uninstall the old version and run the following command to check whether MySQL Serverrpm-qa is installed | if grep mysql is installed, run the following command to uninstall rpm-e mysql // normal deletion mode rpm-e -- nodeps mysql rpm-e -- nodeps mysql-develrpm-e -- nodeps mysql-libs // strong deletion mode, if the preceding command is used to delete other dependent files, you can use this command to forcibly delete them. yum remove mysql-libs 2: install the yum-y I package required by MySQL1. Nstall cmake gcc-c ++ autoconf automake zlib * libxml * \ ncurses-devel libtool-ltdl-devel * make bison-devel libaio \ openssl-devel libevent-devel \ libaio -devel pam-devel boost-devel valgrind-devel \ libnl-devel popt-static 2. create a group and user groupadd mysqluseradd-s/sbin/nologin-g mysql-M mysqlpasswd mysqlmysql01 for mysql! Id mysql 3. set the user's system resource limit # vi/etc/security/limits. confmysql soft nproc 2047 mysql hard nproc 16384 mysql soft nofile 1024 mysql hard nofile 655364. compile and install tar xf mariadb-galera-10.0.19.tar.gzcd cd mariadb-10.0.19 compile and install/*** cmake. -LH -- View mysql-related parameters supported by cmake shell> cmake. -L # overviewshell> cmake. -LH # overview with help textshell> cmake. -LAH # all params with help textshell> ccmake. # re-interactive display During compilation, you need to clear the old object file and Cache Information # make clean # rm-f CMakeCache.txt *****/cmake \-DCMAKE_INSTALL_PREFIX =/data/mysql \-DMYSQL_UNIX_ADDR =/data/mysql/ mysql. sock \-metrics = 1 \-metrics = 1 \-metrics = 1 \-DWITH_READLINE = 1 \-DMYSQL_DATADIR =/data/mysql/data \-DMYSQL_TCP_PORT = 33306 \-DENABLED_LOCAL_INFILE = 1 \-DWITH_EXTRA_CHARSETS = all \-DDEFAULT_CHARSET = utf8 \-DD EFAULT_COLLATION = utf8_general_ci \-DEXTRA_CHARSETS = all \-DWITH_WSREP = 1 \-DWITH_INNODB_DISALLOW_WRITES = 1 make-j4make install 3: Configure MySQL1, modify/usr/local/mysql permission mkdir-p/data/mysqlmkdir/data/mysql/{innodb_data, data, tmp}-pmkdir/data/mysql/mysql_logs/{binary_log, innodb_log, query_log, slow_query_log, error_log}-p2. modify the permission chown-R mysql/data/mysqlchgrp-R mysql/data/mysql3. modify the parameter # rm-rf/etc/my. Cnf # vi/data/mysql/my. cnf # Link file # ln-fs/data/mysql/my. cnf/etc/my. cnfll/etc/my. cnf lrwxrwxrwx. 1 root 23 Nov 18 :30/etc/my. cnf->/data/mysql/my. cnfchown-R mysql/data/mysqlchgrp-R mysql/data/mysql5. initialize the database cd/data/mysql/scripts #. /mysql_install_db -- defaults-file =/etc/my. cnf -- user = mysql -- basedir =/data/mysql \ -- datadir =/data/mysql/data 6. start MySQLchown-R mysql/data/mysqlchgrp-R mysq L/data/mysql -- 6.1 It is recommended to start/data/mysql/bin/mysqld_safe &/data/mysql/bin/mysqld_safe -- datadir = '/data/mysql/data' safely '&-- 6.2 Add a service, copy the service script to init. d directory, and set boot cd/data/mysql/cp support-files/mysql. server/etc/init. d/mysqlchkconfig mysql on 7. after configuring mysql user MySQL to start successfully, the root user has no password by default. We need to set the root password. 7.1 modify the/etc/profile file and add # vi/etc/profilePATH =/data/mysql/bin: $ PATHexport PATH # source/etc/profile at the end of the file, you can enter mysql directly in the terminal. In the mysql environment, execute the following command to change the root password-7.2 modify the mysql administrator password 1. modify the current user PASSWORD mysql-uroot-pSET PASSWORD = PASSWORD ('pass01'); flush privileges; 2. set a password for all root users: method 1 (recommended) # mysql-uroot-pMariaDB [(none)]> MariaDB [(none)]> select host, user, password from mysql. user; + ------------- + ------ + ---------- + | host | User | password | + ------------- + ------ + ---------- + | localhost | root | db02.zp.com | root | 127.0.0.1 | root | :: 1 | root | localhost | db02.zp.com | + ------------- + ------ + ---------- + 6 rows in set (0.00 sec) update mysql. user set password = password ('pass01') where user = 'root' limit 100; flush privileges; 3. delete all anonymous users (do not delete root @ localhost) drop user ''@ 'localhost'; Delete from mysql. user where user = ''limit 10; commit; flush privileges; delete from mysql. user where host = 'db01 .mysql.com '; flush privileges; -- 7.3 Set remote access for root users -- Method 1: granting mysql> grant all privileges on *. * TO 'root' @ '%' identified by 'pass01' \ with grant option; flush privileges; select host, user, password from mysql. user; -- 7.4 log on to mysql # mysql-hlocalhost-uroot-ppass01 ---- 7.5 set the linux script vi ~ /. Bash_profile # ocpyang set (only Intranet IP addresses can be written when mysql is bound to an intranet IP address) alias mysql = "mysql-U-hlocalhost-uroot-ppass01 -- auto-rehash" alias errorlog = "cat/data/mysql/mysql_logs/error_log/error. log "alias mycnf =" cd/data/mysql "export PATH =/data/mysql/scripts: $ PATHsource ~ /. Bash_profile ---- 7.7 modify the permission chown-R mysql/data/mysqlchgrp-R mysql/data/mysql ---- 7.8 Common Startup error or warning cat/data/mysql/mysql_logs/error_log/error. log Warning] 'proxies _ priv' entry '@ % root@mysql.ocp.com' ignored in -- skip-name-resolve mode. solution: delete from mysql. proxies_priv where host = 'db01 .mysql.com '; commit; flush privileges; **************************************** * ************************************ 3. galera-related configuration ************************************* **************************************** * --- 3.1 create wsrep user grant all privileges on *. * TO 'wsrep '@' % 'identified by 'wsrep'; flush privileges; --- 3.2 install galera -- 3.2.1 install the software yum install boost-devel yum install check-devel wget on which galera depends http://cznic.dl.sourceforge.net/project/scons/scons/2.3.4/scons-2.3.4.tar.gztar Zxvf scons-2.3.4.tar.gz cd scons-2.3.4python setup. py install -- 3.2.2 install galera # rpm-ql | grep galera # cd/soft # rpm-ivh galera-25.3.5-1.rhel6.x86_64.rpm # ls/usr/lib64/galera lib1_a_smm.so --- 3.2.3 # tar xf socat-2.0.0-b7.tar.gz # cd socat #. /configure # make & make install --- 3.2.4 modify the mysql configuration file mkdir/etc/my. cnf. dcd/soft/mariadb-10.0.19/support-filescp wsrep. cnf/etc/my. cnf. d/# vi/etc/my. cnf. d/wsrep. c Nf # notde01 [mysqld] wsrep_on = ONbinlog_format = ROWdefault-storage-engine = innodb # to reduce conflicts innodb_autoinc_lock_mode = 2innodb_locks_unsafe_for_binlog = conflict = 2 # This improves performance, galera ensures that no data is lost: query_cache_size = bytes = 0wsrep_provider =/usr/lib64/galera/lib1_a_smm.so # modify wsrep_cluster_name = "galera_cluster" # modify wsrep_cluster_address = "gcomm: // "# modify wsrep_node_address = '2017. 168.50.10, 192.168. 50.20, 192.168.50.30 '# modify wsrep_node_name = 'db01' # modify wsrep_slave_threads = threads = wsrep_sst_method = mysqldump # yes # rsync, xtrabackup, mysqldumpwsrep_sst_auth = root: pass01 # modify # no Tde02 [mysqld] wsrep_on = ONbinlog_format = ROWdefault-storage-engine = innodb # to reduce conflicts, innodb_autoinc_lock_mode = 2innodb_flush_log_at_trx_commit = 2 # improves performance, galera ensures that no data is lost: query_cache_size = bytes = 0wsrep_provider =/usr/lib64/galera/volumes # modify wsrep_cluster_name = "a_a_cluster" # modify hosts = "gcomm: // 192.168.50.10, 192.168.50.20, 192.168.50.30 "# modify wsrep_node_address = '2017. 168.50.20 '# repair Change wsrep_node_name = 'db02' # modify wsrep_slave_threads = threads = 0wsrep_policy_cmd = wsrep_sst_method = mysqldump # You can modify # rsync, xtrabackup, mysqldump, xtrabackup-v2wsrep_sst_auth = root: pass01 # modify # notde03 [mysq Ld] wsrep_on = ONbinlog_format = ROWdefault-storage-engine = innodb # to reduce conflicts, innodb_autoinc_lock_mode = 2innodb_locks_unsafe_for_binlog = login = 2 # improves performance, galera ensures that no data is lost: query_cache_size = bytes = 0wsrep_provider =/usr/lib64/galera/volumes # modify wsrep_cluster_name = "a_a_cluster" # modify hosts = "gcomm: // 192.168.50.10, 192.168.50.20, 192.168.50.30 "# modify wsrep_node_addr Ess = '2017. 168.50.30 '# modify wsrep_node_name = 'db03' # modify wsrep_slave_threads = threads = wsrep_sst_method = mysqldump # yes # rsync, xtrabackup, mysqldump, xtrabackup-v2wsrep_sst_auth = root: p Ass01 # modify echo '! Includedir/etc/my. cnf. d/'>/etc/my. cnf --- 4. use rsync, xtrabackup, mydupm -- 4.1 Use rsyncyum-y install rsync # tar xvzf socat-2.0.0-b8.tar.gz # cd socat-2.0.0-b8 #. /configure # make & make install -- we strongly recommend that you add xtrabackup and socat to path # vi/etc/profile PATH =/data/mysql/bin:/usr/local/bin/socat: /usr/local/xtrabackup/bin: $ PATHexport PATHln-s/usr/local/bin/socat/usr/sbin/ln-s/usr/local/xtrabackup/bin/*/usr/sbin/-- 4.2 Use xtrabackup --- 5. initialize startup -- Method 1: modify my. cnf and set wsrep_cluster_address = gcomm: //. Then modify the configuration after startup. -- Method 2: run the following command to start mysql (RedHat and CentOS systems are supported) /data/mysql/bin/mysqld_safe -- datadir = '/data/mysql/data' -- wsrep-cluster-address = "gcomm: // "&/data/mysql/bin/mysqld_safe -- datadir = '/data/mysql/data' & ---- 6. start related to each node # netstat-lntp | grep 33306tcp 0 0 ::: 33306 ::: * LISTEN 3072/mysqld # pkill mysqldNODE1 start first, and other nodes are unordered. ---- 7. view Cluster connection status show status like 'wsrep _ cluster_size '; show status like 'wsrep % ';


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.