linux下mysql集群的安装

上传人:woxinch****an2018 文档编号:38632272 上传时间:2018-05-05 格式:DOCX 页数:8 大小:22.50KB
返回 下载 相关 举报
linux下mysql集群的安装_第1页
第1页 / 共8页
linux下mysql集群的安装_第2页
第2页 / 共8页
linux下mysql集群的安装_第3页
第3页 / 共8页
linux下mysql集群的安装_第4页
第4页 / 共8页
linux下mysql集群的安装_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《linux下mysql集群的安装》由会员分享,可在线阅读,更多相关《linux下mysql集群的安装(8页珍藏版)》请在金锄头文库上搜索。

1、linux 下 mysql 集群的安装2011-05-13 18:30 1397 人阅读 评论(1) 收藏 举报mysqllinuxshell 集群数据库 database目录(?)+ 1.下载安装文件下载安装文件操作系统:CentOS release 5.5Mysql: mysql-cluster-gpl-7.1.10-linux-i686-glibc23.tar.gz2.安装安装.tar.gz 文件文件详情参考 mysql 的官方手册。数据节点和数据节点和 mysql 节点的安装节点的安装1.检查系统中是否已经存在 mysql 用户和组。查看/etc/passwd 和/etc/group

2、文件,检查系统是否已存在 mysql 用户和组。如果不存在,用以下命令添加:shell groupadd mysqlshell useradd g mysql mysql2.解压安装。2.1 进入安装文件所在目录,假设在/var/tmp 目录下:shell cd /var/tmpshell tar C /usr/local xzvf mysql-cluster-gpl-7.1.10-linux-i686-glibc23.tar.gzshell ln s /usr/local/mysql-cluster-gpl-7.1.10-linux-i686-glibc23 /usr/local/mysql

3、2.2 执行安装脚本:shell cd mysqlshell scripts/mysql_install_db user=mysql2.3 修改权限:shell chown R root .shell chown R mysql datashell chgrp R mysql .2.4 复制执行文件,加入系统启动项:shell cp support-files/mysql.server /etc/rc.d/init.d/shell chmod +x /etc/rc.d/init.d/mysql.servershell chkconfig add mysql.server管理节点的安装管理节点的

4、安装1.解压安装shell cd /var/tmpshell tar xzvf mysql-cluster-gpl-7.1.10-linux-i686-glibc23.tar.gzshell cd mysql-cluster-gpl-7.1.10-linux-i686-glibc23shell cp bin/ndb_mgm* /usr/local/bin2.修改权限shell cd /usr/local/binshell chmod +x ndb_mgm*3.配置文件配置文件3.1 创建数据节点和创建数据节点和 mysql 节点的节点的 f 配置文件配置文件shell vi /etc/f 内容

5、如下:mysqld# Options for mysqld process:ndbcluster # run NDB storage enginendb-connectstring=192.168.0.10 # location of management servermysql_cluster# Options for ndbd process:ndb-connectstring=192.168.0.10 # location of management server3.2 创建管理节点的创建管理节点的 config.ini 配置文件配置文件shell mkdir /var/lib/mysq

6、l-clustershell cd /var/lib/mysql-clustershell vi config.iniconfig.ini 内容如下:ndbd default# Options affecting ndbd processes on all data nodes:NoOfReplicas=2 # Number of replicasDataMemory=80M # How much memory to allocate for data storageIndexMemory=18M # How much memory to allocate for index storage#

7、 For DataMemory and IndexMemory, we have used the# default values. Since the “world“ database takes up# only about 500KB, this should be more than enough for# this example Cluster setup.tcp default# TCP/IP options:portnumber=2202 # port that is free for all the hosts in the cluster# Note: It is reco

8、mmended that you do not specify the port# number at all and simply allow the default value to be used# insteadndb_mgmd# Management process options:hostname=192.168.0.10 # Hostname or IP address of MGM nodedatadir=/var/lib/mysql-cluster # Directory for MGM node log filesndbd# Options for data node “A

9、“:# (one ndbd section per data node)hostname=192.168.0.30 # Hostname or IP addressdatadir=/usr/local/mysql/data # Directory for this data nodes data filesndbd# Options for data node “B“:hostname=192.168.0.40 # Hostname or IP addressdatadir=/usr/local/mysql/data # Directory for this data nodes data f

10、ilesmysqld# SQL node options:hostname=192.168.0.20 # Hostname or IP address# (additional mysqld connections can be# specified for this node for various# purposes such as running ndb_restore)4.启动集群启动集群1.启动管理服务器:(正常情况下,它们位于/usr/local/mysql/bin 目录下)。shell ndb_mgmd -config-file=/var/lib/mysql-cluster/co

11、nfig.ini2.启动数据节点。首次为给定的 DB 节点启动 ndbd 时,应使用“initial”选项shell cd /usr/local/mysql/binshell ./ndbd -initialshell ./ndbd3.启动 mysql 节点。shell cd /usr/local/mysql/binshell mysqld_safe -user=mysql /查看存储过程mysql SHOW DATABASES;mysql SHOW TABLES;mysql DESCRIBE table_name;mysql SELECT DATABASE(); /查看当前使用的数据库mysq

12、l select user();mysql select current_user(); mysql grant all privileges on db.* to newuser172.21.30.% identified by pw;/创建新用户 newuser,密码 pw,并授权对 db 数据库的访问在 mysql 的配置文件 f,mysqld部分,有时需要添加以下字段,便于连接 mysql 数据库skip-grant-tablesskip-name-resolvemysql cluster 部署方案 1:实验方案:1 台管理节点,2 台 mysql 节点(A,B),2 台数据节点(C,

13、D),1 份数据副本。实验结果:1.成功实现数据的同步。在 mysql 节点 A 上创建一个数据表,在 mysql 节点 B上可以成功访问。反之亦然。2.成功实现数据的分布式存储。关闭 2 个数据节点 C 和 D 中的任意一个,集群都无法正常访问。mysql cluster 部署方案 2:实验方案:1 台管理节点,2 台 mysql 节点(A,B),2 台数据节点(C,D),2 份数据副本。实验结果:1.成功实现数据的同步。在 mysql 节点 A 上创建一个数据表,在 mysql 节点 B上可以成功访问。反之亦然。2.成功实验数据的运行备份。关闭 2 个数据节点 C 和 D 中的任意一个,集群仍然可以正常访问。mysql cluster 部署方案 3:实验方案:1 台管理节点,1 台 mysql 节点(E),4 台数据节点(A,B,C,D),2 份数据副本。实验结果:1.成功实验数据的运行备份。关闭 4 个数据节点 A,B,C,D 中的任意一个,集群仍然可以正常访问。关闭 4 个数据节点中某两个存储不同数据块的数据节点,集群仍然可以正常访问。关闭 4 个数据节点中某两个存储相同数据块,或者 3 个以上数据节点,集群无法访问。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 高中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号