資源描述:
《mysql_cluster雙機集群》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、mysqlcluster雙機集群一、介紹如何安裝配置基于2臺服務(wù)器的MySQL集群。并且實現(xiàn)任意一臺服務(wù)器出現(xiàn)問題或宕機時MySql集群依然能夠繼續(xù)運行。加下后續(xù)的(keepalived+lvs+mysqlcluster文檔),可以實現(xiàn)Mysql雙機的高可用及負(fù)載均衡。安裝環(huán)境及軟件包:vmwareworkstation5.5.3mysql-5.2.3-falcon-alpha.tar.gzgentoo2006.1Server1:192.168.1.111Server2:??192.168.1.110二、在Server1和
2、Server2上安裝MySQL以下步驟需要在Server1和Server2上各做一次#mvmysql-5.2.3-falcon-alpha.tar.gz??/tmp/package#cd/tmp/package#groupaddmysql#useradd-gmysqlmysql#tar-zxvfmysql-5.2.3-falcon-alpha.tar.gz#rm-fmysql-5.2.3-falcon-alpha.tar.gz#mvmysql-5.2.3-falcon-alphamysql#cdmysql#./config
3、ure--prefix=/usr--with-extra-charsets=complex--with-plugin-ndbcluster--with-plugin-partition--with-plugin-innobase#make&&makeinstall#ln-s/usr/libexec/ndbd/usr/bin#ln-s/usr/libexec/ndb_mgmd/usr/bin#ln-s/usr/libexec/ndb_cpcd/usr/bin#ln-s/usr/libexec/mysqld/usr/bin#l
4、n-s/usr/libexec/mysqlmanager/usr/bin#mysql_install_db--user=mysql三、安裝并配置節(jié)點以下步驟需要在Server1和Server2上各做一次1.配置管理節(jié)點配置文件:#mkdir/var/lib/mysql-cluster#cd/var/lib/mysql-cluster#viconfig.ini在config.ini中添加如下內(nèi)容:[ndbddefault]NoOfReplicas=2MaxNoOfConcurrentOperations=10000DataM
5、emory=80MIndexMemory=24MTimeBetweenWatchDogCheck=30000DataDir=/var/lib/mysql-clusterMaxNoOfOrderedIndexes=512StartPartialTimeout=100StartPartitionedTimeout=100ArbitrationTimeout=5000TransactionDeadlockDetectionTimeout=5000HeartbeatIntervalDbDb=5000StopOnError=0[nd
6、b_mgmddefault]DataDir=/var/lib/mysql-cluster[ndb_mgmd]Id=1HostName=192.168.1.111[ndb_mgmd]Id=2HostName=192.168.1.110[ndbd]Id=3HostName=192.168.1.111[ndbd]Id=4HostName=192.168.1.110[mysqld]ArbitrationRank=2(非常重要,全靠有它,才可以形成仲裁競爭,從而當(dāng)另一個機子當(dāng)了時,此機還可以有知道partion完整的節(jié)點)[mysq
7、ld]ArbitrationRank=2[tcpdefault]PortNumber=631322.配置通用my.cnf文件,mysqld及ndbd,ndb_mgmd均使用此文件.#vi/etc/my.cnf在my.cnf中添加如下內(nèi)容:[mysqld]default-storage-engine=ndbcluster??避免在sql語句中還要加入ENGINE=NDBCLUSTER。ndbclusterndb-connectstring=192.168.1.111,192.168.1.110[ndbd]connect-st
8、ring=192.168.1.111,192.168.1.110[ndb_mgm]connect-string=192.168.1.111,192.168.1.110[ndb_mgmd]config-file=/var/lib/mysql-cluster/config.ini[mysql_cluster