欢迎来到天天文库
浏览记录
ID:13588361
大小:33.00 KB
页数:6页
时间:2018-07-23
《mysql_cluster双机集群》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、mysqlcluster双机集群一、介绍如何安装配置基于2台服务器的MySQL集群。并且实现任意一台服务器出现问题或宕机时MySql集群依然能够继续运行。加下后续的(keepalived+lvs+mysqlcluster文档),可以实现Mysql双机的高可用及负载均衡。安装环境及软件包: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三、安装并配置节点以下步骤需要在Server1和Server2上各做一次1.配置管理节点配置文件:#mkdir/var/lib/mysql-cluster#cd/var/lib/mysql-cluster#viconfig.ini在config.ini中添加如下内容:[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(非常重要,全靠有它,才可以形成仲裁竞争,从而当另一个机子当了时,此机还可以有知道partion完整的节点)[mysq
7、ld]ArbitrationRank=2[tcpdefault]PortNumber=631322.配置通用my.cnf文件,mysqld及ndbd,ndb_mgmd均使用此文件.#vi/etc/my.cnf在my.cnf中添加如下内容:[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
此文档下载收益归作者所有