mysql cluster linux_【完美】Mysql-cluster数据库集群搭建(linux)
介紹
《Mysql-cluster數據庫集群介紹》
安裝系統:Linux CentOS7.4查看是否安裝mysqlrpm -qa | grep mysql普通刪除rpm -e mysql強力刪除rpm -e --nodeps mysql通過wget安裝wget?https://dev.mysql.com/get/Downloads/MySQL-Cluster-7.5/mysql-cluster-gpl-7.5.8-linux-glibc2.12-x86_64.tar.gz(如果沒有安裝wget,執行yum -y install wget)解壓tar xvf?mysql-cluster-gpl-7.5.8-linux-glibc2.12-x86_64.tar.gz新建文件夾(用于NDB)mkdir?/usr/local/mysql-clustermkdir?/usr/local/mysql-cluster/logsmkdir?/usr/local/mysql-cluster/data(用于Mysql)mkdir/usr/local/mysqlmkdir/usr/local/mysql/datamkdir/usr/local/mysql/data/mysql一句話:mkdir/usr/local/mysql-cluster?/usr/local/mysql-cluster/logs?/usr/local/mysql-cluster/data/usr/local/mysql/usr/local/mysql/data?/usr/local/mysql/data/mysql復制程序cp??mysql-cluster-gpl-7.5.8-linux-glibc2.12-x86_64/bin/ndb_mgm* /usr/local/mysql-clustercp??mysql-cluster-gpl-7.5.8-linux-glibc2.12-x86_64/bin/ndbd /usr/local/mysql-clustercp -r?mysql-cluster-gpl-7.5.8-linux-glibc2.12-x86_64/.?/usr/local/mysql管理節點配置新建配置文件vi??/usr/local/mysql-cluster/config.ini------------------------------------------------------------------[ndbd default]
NoOfReplicas=1
DataMemory=6144M
IndexMemory=1024MStopOnError=0StringMemory=5MMaxNoOfConcurrentTransactions=100000MaxNoOfConcurrentOperations=110000MaxNoOfLocalOperations=250000MaxNoOfConcurrentIndexOperations=81920MaxNoOfConcurrentScans=256MaxNoOfLocalScans=1000MaxNoOfOpenFiles=1000MaxNoOfAttributes=10000ODirect=1MaxNoOfTables=20320MaxNoOfOrderedIndexes=2048MaxNoOfUniqueHashIndexes=2048
[ndb_mgmd]NodeId=1
HostName=192.168.1.1
DataDir=/usr/local/mysql-cluster/logs
[ndbd]
NodeId=2HostName=192.168.1.1
DataDir=/usr/local/mysql-cluster/data
[mysqld]NodeId=3
HostName=192.168.1.1
[ndbd]NodeId=4
HostName=192.168.1.2
DataDir=/usr/local/mysql-cluster/data
[mysqld]NodeId=5
HostName=192.168.1.2[mysqld]-------------------------------------------------------------------開始編輯? insert鍵
退出編輯? esc鍵
保存退出? :wq
強制退出? :q!數據節點配置
touch /usr/local/mysql/error.log
touch /usr/local/mysql/mysql.pidvi/usr/local/mysql/support-files/my-default.cnf--------------------------------------------------------------------[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data/mysqlpid-file = /usr/local/mysql/mysql.pid
log-error = /usr/local/mysql/error.log
user = root
port = 3306tmp_table_size = 256Mmax_heap_table_size = 256Mndbclusterndb-connectstring=192.168.1.1
[mysql_cluster]
ndb-connectstring=192.168.1.1
[ndbd]
ndb-connectstring=192.168.1.1[mysql_safe]log-error = /usr/local/mysql/error.log--------------------------------------------------------------------cp?/usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
啟動管理節點/usr/local/mysql-cluster/ndb_mgmd --configdir=/usr/local/mysql-cluster -f /usr/local/mysql-cluster/config.ini --initial --reload/usr/local/mysql-cluster/ndb_mgm -e show(查看和管理)/usr/local/mysql-cluster/ndb_mgm -e shutdown(關閉集群)/usr/local/mysql-cluster/ndb_mgm -eexit(退出)數據節點/usr/local/mysql-cluster/ndbd --initialSQL節點新增用戶組mysql和用戶msyqlgroupadd mysqluseradd -g mysql mysql#(如果沒有權限,可登錄root去新增)cd /usr/local/mysql#修改文件權限chown -R mysql:mysql ./#初始化mysqlbin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/mysql(如果data ..有數據則新建data和data/mysql)出現以下信息則標示成功[Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID:82246b8e-e62b-11e7-b5ad-000c29aa8807.
[Note] A temporary password is generated for root@localhost:hWuJyniWd3,.記下UUID和密碼#復制mysql到服務自動啟動里面
cp support-files/mysql.server /etc/init.d/mysqld#修改權限為755 也就是root可以執行
chmod 755 /etc/init.d/mysqld#復制配置文件到etc下,因為默認啟動先去etc下加載配置文件
cp support-files/my-default.cnf /etc/my.cnf啟動,重啟,停止mysql服務service mysqld startservice mysqld restartservice mysqld stop查看mysql是否已啟動/etc/rc.d/init.d/mysqld status
linux下mysql錯誤Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)點擊鏈接查看解決方案-------------------------------------------------------------Your password has expired. To log in you must change it using a client that supports expired passwords點擊鏈接查看解決方案
-------------------------------------------------------------Host is not allowed to connect to this MySQL server點擊鏈接查看解決方案
-------------------------------------------------------------Unable to connect with connect string: nodeid=0,172.24.221.100:1186
點擊鏈接查看解決方案
-------------------------------------------------------------
總結
以上是生活随笔為你收集整理的mysql cluster linux_【完美】Mysql-cluster数据库集群搭建(linux)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android sdk 封装html5,
- 下一篇: 复习Java异常处理_异常分类_自定义异