查看数据目录下的内容 [root@localhost usr]# cd /var/lib/mysql [root@localhost mysql]# ls -trl total 126800 -rw-r-----. 1 mysql mysql 50331648 Jul 1 19:21 ib_logfile1 -rw-r-----. 1 mysql mysql 56 Jul 1 19:21 auto.cnf -rw-------. 1 mysql mysql 1676 Jul 1 19:21 ca-key.pem -rw-r--r--. 1 mysql mysql 1083 Jul 1 19:21 ca.pem -rw-------. 1 mysql mysql 1676 Jul 1 19:21 server-key.pem -rw-r--r--. 1 mysql mysql 1087 Jul 1 19:21 server-cert.pem -rw-------. 1 mysql mysql 1680 Jul 1 19:21 client-key.pem -rw-r--r--. 1 mysql mysql 1087 Jul 1 19:21 client-cert.pem -rw-r--r--. 1 mysql mysql 452 Jul 1 19:21 public_key.pem -rw-------. 1 mysql mysql 1680 Jul 1 19:21 private_key.pem drwxr-x---. 2 mysql mysql 4096 Jul 1 19:21 performance_schema drwxr-x---. 2 mysql mysql 4096 Jul 1 19:21 mysql drwxr-x---. 2 mysql mysql 12288 Jul 1 19:21 sys -rw-r-----. 1 mysql mysql 417 Jul 1 19:21 ib_buffer_pool -rw-rw----. 1 root root 5 Jul 1 19:21 mysqld_safe.pid -rw-------. 1 mysql mysql 5 Jul 1 19:21 mysql.sock.lock srwxrwxrwx. 1 mysql mysql 0 Jul 1 19:21 mysql.sock -rw-r-----. 1 mysql mysql 5 Jul 1 19:21 localhost.localdomain.pid -rw-r-----. 1 mysql mysql 3932160 Jul 1 19:21 xb_doublewrite -rw-r-----. 1 mysql mysql 12582912 Jul 1 19:21 ibtmp1 -rw-r-----. 1 mysql mysql 12582912 Jul 1 19:21 ibdata1 -rw-r-----. 1 mysql mysql 50331648 Jul 1 19:21 ib_logfile0 -rw-r-----. 1 mysql mysql 4653 Jul 1 19:22 localhost.localdomain.er
默认安装的软件目录 查看软件目录下的内容 [root@localhost ~]# cd /usr/ [root@localhost usr]# ls -trl total 144 drwxr-xr-x. 2 root root 4096 Sep 23 2011 games drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc drwxr-xr-x. 4 root root 4096 Mar 23 16:03 src lrwxrwxrwx. 1 root root 10 Mar 23 16:03 tmp -> ../var/tmp dr-xr-xr-x. 15 root root 4096 Mar 23 16:17 lib drwxr-xr-x. 42 root root 4096 Apr 3 03:15 include drwxr-xr-x. 22 root root 12288 Apr 3 03:41 libexec drwxr-xr-x. 14 root root 4096 Apr 9 08:25 local dr-xr-xr-x. 2 root root 36864 Jul 1 16:11 bin dr-xr-xr-x. 92 root root 49152 Jul 1 16:11 lib64 dr-xr-xr-x. 2 root root 12288 Jul 1 16:11 sbin drwxr-xr-x. 175 root root 4096 Jul 1 16:11 share 启动Percona XtraDB集群服务 service mysql start 查看集群状态 [root@localhost mysql]# service mysql status SUCCESS! MySQL (Percona XtraDB Cluster) running (2263) 实际上集群的进程就是mysqld的进程 [root@localhost mysql]# service mysql status SUCCESS! MySQL (Percona XtraDB Cluster) running (2928) [root@localhost mysql]# ps -ef|grep mysql root 2824 1 0 19:56 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid mysql 2928 2824 2 19:56 pts/1 00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid --wsrep_start_position=00000000-0000-0000-0000-000000000000:-1 root 2982 2711 0 19:57 pts/1 00:00:00 grep mysql
重新设置root密码 [root@localhost log]# mysqld_safe --skip-grant-tables --skip-networking& [root@localhost log]# mysql -uroot mysql> update mysql.user set authentication_string=password('root') where user='root'; mysql> commit; [root@localhost log]# mysqladmin shutdown [root@localhost log]# service mysql start Starting MySQL (Percona XtraDB Cluster).. SUCCESS! [root@localhost ~]# mysql -uroot -p mysql> alter user root@localhost identified by 'root'; 2. 在所有节点上配置写集合复制相关的参数 这包括Glera库的路径和其他节点的位置