一、准备阶段
1、5台机器
10.1.2.180 作为mysql机器
10.1.2.200-202作为集群节点
10.1.2.203作为nginx反向代理
2、拓扑图
三、部署步聚
1、180机器
1.1由于前面单节,180机器安装了mysql和Mogilefs,而现在180作为单独Mysql机器,所以先停掉Mogilefs服务
[root@logicserver tmp]# /etc/init.d/mogilefsd stop Stopping mogilefsd [确定]
1.2创建mysql用户root的密码,方便集群节点连接上去
MariaDB [mogilefs]> GRANT ALL ON *.* TO ‘root‘@‘10.1.%.%‘ IDENTIFIED BY ‘168‘;
MariaDB [mogilefs]> flush privileges; Query OK, 0 rows affected (0.04 sec)
2、200机器
2.1 重新初始化数据库
[root@xenserver1 mogdata]# mogdbsetup --dbhost=10.1.2.180 --dbname=mogilefs --dbport=3306 --dbrootuser=root --dbrootpass=168 --dbuser=moguser --dbpass=mog168
2.2修改配置文件
root@xenserver1 mogdata]# vim /etc/mogilefs/mogilefsd.conf db_dsn = DBI:mysql:mogilefs:host=10.1.2.180 db_user = moguser db_pass = mog168 listen = 0.0.0.0:7001
2.3重启服务
[root@xenserver1 mogdata]# service mogilefsd restart
[root@xenserver1 mogdata]# ss -tnl | sed -n ‘/7001/p‘ LISTEN 0 128 127.0.0.1:7001 *:*
2.4启动 mogstored服务
[root@xenserver1 ~]# vim /etc/mogilefs/mogstored.conf maxconns = 10000 httplisten = 0.0.0.0:7500 mgmtlisten = 0.0.0.0:7501 docroot = /data0/nfs/mogdata/
[root@xenserver1 ~]# service mogstored restart
[root@xenserver1 ~]# ss -tnl | sed -n ‘/7500\|7501\|7001/p‘ LISTEN 0 128 127.0.0.1:7001 *:* LISTEN 0 128 *:7500 *:* LISTEN 0 128 *:7501 *:*
2.3由于原来已经有了,所以先删除再重新添加
[root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host list 10.1.2.200 [1]: alive IP: 10.1.2.200:7500 10.1.2.201 [2]: alive IP: 10.1.2.201:7500
[root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host delete 10.1.2.200 Failure deleting host: host_not_empty Unable to delete host; it contains devices still
2.4有错误提示了,先去到180数据库下删除dev1,dev2
MariaDB [mogilefs]> select * from device -> ; +-------+--------+--------+--------+----------+---------+------------+ | devid | hostid | status | weight | mb_total | mb_used | mb_asof | +-------+--------+--------+--------+----------+---------+------------+ | 1 | 1 | down | 100 | 336801 | 66 | 1443524971 | | 2 | 2 | alive | 100 | 3737 | 735 | 1443525069 | +-------+--------+--------+--------+----------+---------+------------+ 2 rows in set (0.00 sec) MariaDB [mogilefs]> delete from device where devid=1; Query OK, 1 row affected (0.02 sec) MariaDB [mogilefs]> delete from device where devid=2; Query OK, 1 row affected (0.01 sec)
2.5再执行删除主机
[root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host delete 10.1.2.200 [root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host delete 10.1.2.201 [root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host list
2.6把自己添加进来
[root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host add 10.1.2.200 --ip=10.1.2.200 --status=alive [root@xenserver1 ~]# mogadm --trackers=10.1.2.200:7001 host list 10.1.2.200 [1]: alive IP: 10.1.2.200:7500
本文出自 “散人” 博客,请务必保留此出处http://zouqingyun.blog.51cto.com/782246/1699285
原文地址:http://zouqingyun.blog.51cto.com/782246/1699285