柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!
全部博文(1669)
分类: Mysql/postgreSQL
2016-04-12 13:50:58
版权声明:本文为博主原创文章,未经博主允许不得转载。
管理结点
|
mysql-mgm
|
192.168.124.141
|
数据结点 1
|
mysql-ndbd-1
|
192.168.124.142
|
数据结点 2
|
mysql-ndbd-2
|
192.168.124.143
|
SQL 结点1
|
mysql-sql-1
|
192.168.124.144
|
SQL 结点2
|
mysql-sql-2
|
192.168.124.145
|
cd /root/Downloads tar -xvzf mysql-cluster-gpl-7.3.4-linux-glibc2.5-x86_64.tar.gz mv mysql-cluster-gpl-7.3.4-linux-glibc2.5-x86_64 /usr/local/mysql |
chkconfig --level 35 iptables off |
gedit /etc/selinux/config |
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted |
mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
gedit config.ini
|
[ndbd default] NoOfReplicas=2 DataMemory=80M IndexMemory=18M [ndb_mgmd] NodeId=1 hostname=192.168.124.141 datadir=/var/lib/mysql-cluster [ndbd] NodeId=2 hostname=192.168.124.142 datadir=/usr/local/mysql/data
[ndbd]
NodeId=3 hostname=192.168.124.143 datadir=/usr/local/mysql/data
[mysqld]
NodeId=4 hostname=192.168.124.144 [mysqld] NodeId=5 hostname=192.168.124.145 |
cp /usr/local/mysql/bin/ndb_mgm* /usr/local/bin cd /usr/local/bin chmod +x ndb_mgm* |
groupadd mysql useradd -g mysql mysql |
gedit /etc/my.cnf |
[mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data socket=/usr/local/mysql/sock/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [mysql_cluster] ndb-connectstring=192.168.124.141 |
cd /usr/local/mysql mkdir sock scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data |
chown -R root . chown -R mysql.mysql /usr/local/mysql/data chown -R mysql.mysql /usr/local/mysql/sock chgrp -R mysql . |
cp support-files/mysql.server /etc/rc.d/init.d/ chmod +x /etc/rc.d/init.d/mysql.server chkconfig --add mysql.server |
groupadd mysql useradd -g mysql mysql |
gedit /etc/my.cnf |
[client] socket=/usr/local/mysql/sock/mysql.sock [mysqld] ndbcluster datadir=/usr/local/mysql/data socket=/usr/local/mysql/sock/mysql.sock ndb-connectstring=192.168.124.141 [mysql_cluster] ndb-connectstring=192.168.124.141 |
cd /usr/local/mysql mkdir sock scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data |
chown -R root . chown -R mysql.mysql /usr/local/mysql/data chown -R mysql.mysql /usr/local/mysql/sock chgrp -R mysql . |
cp support-files/mysql.server /etc/rc.d/init.d/ chmod +x /etc/rc.d/init.d/mysql.server chkconfig --add mysql.server |
ndb_mgmd -f /var/lib/mysql-cluster/config.ini |
ndb_mgm |
/usr/local/mysql/bin/ndbd --initial |
/usr/local/mysql/bin/ndbd |
/usr/local/mysql/bin/mysqld_safe --user=mysql & |
shell> /usr/local/mysql/bin/mysql -u root -p mysql>show databases; mysql>create database aa; mysql>use aa; mysql>CREATE TABLE ctest2 (i INT) ENGINE=NDB; //这里必须指定数据库表的引擎为NDB,否则同步失败 mysql> INSERT INTO ctest2 () VALUES (1); mysql> SELECT * FROM ctest2; |
mysql> create database bb; mysql> use bb; mysql> CREATE TABLE ctest3 (i INT) ENGINE=NDB; mysql> use aa; mysql> INSERT INTO ctest2 () VALUES (3333); mysql> SELECT * FROM ctest2; |
#/usr/local/mysql/bin/ndbd --initial#service mysqld start
|
# /usr/local/mysql/bin/mysql -u root –p
|
shell> /usr/local/mysql/bin/ndb_mgm -e shutdown |
Connected to Management Server at: localhost:1186 2 NDB Cluster node(s) have shutdown. Disconnecting to allow management server to shutdown. |
shell> /etc/init.d/mysql.server stop Shutting down MySQL... SUCCESS! |