반응형

Xpand 노드 추가

 

기존에 MaxScale + 3개의 Xpand에 추가로 xpand4 node 추가 시나리오

 

xpand4
/ect/hosts

10.70.101.16   xpand1
10.70.101.17   xpand2
10.70.101.18   xpand3
10.70.101.19   xpand4
10.70.101.20   maxscale1
--방화벽 OFF (root)

systemctl stop firewalld

systemctl disable firewalld

-- 필요 패키지 설치 (root)


yum install bzip2 mdadm ntp ntpdate screen wget xz -y

yum-config-manager --enable rhui-REGION-rhel-server-optional  (RHEL Only)

-- 엔진 설치 (root)

wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup --skip-server --skip-tools --apply
wget https://dlm.mariadb.com/6f1eb5f1-292b-4195-8295-d8ded5189e72/1601305/xpand/xpand-5.3.14/xpand-5.3.14.el7.tar.bz2
tar xvf xpand-5.3.14.el7.tar.bz2
cd xpand-5.3.14.el7
./xpdnode_install.py --wizard

-- 생성 된 유저 xpand, xpandm 유저에게 엔진 path 설정 (root)
echo "export PATH=$PATH:/opt/clustrix/bin" >> /home/xpandm/.bash_profile
echo "export PATH=$PATH:/opt/clustrix/bin" >> /home/xpand/.bash_profile
chown xpandm:xpandm /home/xpandm/.bash_profile
chown xpand:xpand /home/xpand/.bash_profile

-- xpand , xpandm 유저의 패스워드 설정 (root, 3개 노드 비번 동일하게 하여 관리 편의 성)

passwd xpand

passwd xpandm

-- xpand node 상태 확인

su - xpandm
clx status    <-- 여기서는 각자 자기 노드 1개 밖에 안 보임 ( 아직 클러스터로 만들지 않아서)
Cluster Name:    cl7d4939f00c4f39c1
Cluster Version: 5.3.14
Cluster Status:   OK
Cluster Size:    1 nodes - 8 CPUs per Node
Current Node:    xpand4 - nid 1


nid | Hostname | Status |   IP Address  | TPS |      Used      | Total
----+----------+--------+---------------+-----+----------------+-------
  1 |   xpand4 |    OK  |  10.70.101.19 |  12 |  19.7M (0.10%) |  19.8G
----+----------+--------+---------------+-----+----------------+-------
                           10.70.101.19 |  12 |  19.7M (0.10%) |  19.8G

정상 기동이 되지 않은 경우 clx dbstart 로 xpand 시작


-- DB Root 패스워드 변경


mysql --user=root --no-auto-rehash

SET PASSWORD FOR root@127.0.0.1 = PASSWORD("root1122");

 

xpand1
-- 클러스터 추가

su - xpand

mysql --user=root --password --no-auto-rehash

ALTER CLUSTER ADD '10.70.101.19';

use system

select nodeid , hostname , iface_ip , mysql_port from nodeinfo ;   -- 4개 서버 정보가 보임
+--------+----------+--------------+------------+
| nodeid | hostname | iface_ip     | mysql_port |
+--------+----------+--------------+------------+
|      1 | xpand1   | 10.70.101.16 |       3306 |
|      4 | xpand4   | 10.70.101.19 |       3306 |
|      2 | xpand2   | 10.70.101.17 |       3306 |
|      3 | xpand3   | 10.70.101.18 |       3306 |
+--------+----------+--------------+------------+

-- 클러스터 상태 확인

clx status  (여기서 정상적으로 4개 노드가 보이면 됨)


Cluster Name:    cl90c9aff68a607030
Cluster Version: 5.3.14
Cluster Status:   OK
Cluster Size:    4 nodes - 8 CPUs per Node
Current Node:    xpand1 - nid 1

nid | Hostname | Status |   IP Address  | TPS |      Used      | Total
----+----------+--------+---------------+-----+----------------+-------
  1 |   xpand1 |    OK  |  10.70.101.16 |   0 |  23.3M (0.15%) |  14.9G
  2 |   xpand2 |    OK  |  10.70.101.17 |   0 |  22.1M (0.15%) |  14.9G
  3 |   xpand3 |    OK  |  10.70.101.18 |   0 |  21.6M (0.14%) |  14.9G
  4 |   xpand4 |    OK  |  10.70.101.19 |   0 |  10.6M (0.07%) |  14.9G
----+----------+--------+---------------+-----+----------------+-------
                                            0 |  77.7M (0.13%) |  59.5G

-- SSH key 복사 (root)

su - xpand
clx pubkeyinstall
clx cmd date  (ssh key 정상 복사 유무테스트, 4개 서버의 현재 시간이 나와야 함)
exit

su - xpandm
clx pubkeyinstall
clx cmd date (ssh key 정상 복사 유무테스트, 4개 서버의 현재 시간이 나와야 함)

 

xpand4
-- 클러스터 연결 확인

su - xpand
[xpand@xpand4 ~]$ clx status
Cluster Name:    cl90c9aff68a607030   <-- cl7d4939f00c4f39c1 이름이 변경 됨을 확인
Cluster Version: 5.3.14
Cluster Status:   OK
Cluster Size:    4 nodes - 8 CPUs per Node
Current Node:    xpand4 - nid 4

nid | Hostname | Status |   IP Address  | TPS |      Used      | Total
----+----------+--------+---------------+-----+----------------+-------
  1 |   xpand1 |    OK  |  10.70.101.16 |   2 |  23.7M (0.16%) |  14.9G
  2 |   xpand2 |    OK  |  10.70.101.17 |   2 |  22.8M (0.15%) |  14.9G
  3 |   xpand3 |    OK  |  10.70.101.18 |   0 |  23.3M (0.15%) |  14.9G
  4 |   xpand4 |    OK  |  10.70.101.19 |   0 |   8.6M (0.06%) |  14.9G
----+----------+--------+---------------+-----+----------------+-------
                                            4 |  78.3M (0.13%) |  59.5G


mysql --user=root --password --no-auto-rehash

use system


select * from nodeinfo ;

select username , host from users ;
+------------------+--------------+
| username         | host         |
+------------------+--------------+
| clx_maint        | 127.0.0.1    |
| clx_view_definer | 127.0.0.1    |
| max              | 10.70.101.20 |
| mysql_slave      |              |
| root             | 127.0.0.1    |
| xpand            | localhost    |
| xpandm           | localhost    |
+------------------+--------------+

-- SSH 정상동작 확인 (root)

su - xpand

clx cmd date  (ssh key 정상 복사 유무테스트, 4개 서버의 현재 시간이 나와야 함)
exit

su - xpandm
clx cmd date (ssh key 정상 복사 유무테스트, 4개 서버의 현재 시간이 나와야 함)

 

MaxScale에 노드 추가

 

maxscale1
-- xpand server4 추가

maxctrl create server xpand4 10.70.101.19

  --> Error 발생
       @@xpand4_monitor:node-4가 존재 한다고 나옴 ...

-- 해당 서버를 삭제 후 xpand4 추가


maxctrl destroy server @@xpand_monitor:node-4

maxctrl create server xpand4 10.70.101.19

-- 서버 리스트 확인

@@xpand_monitor:node-4는 삭제된 상태이고 xpand4는 Down으로 확인 됨
모니터를 추가 하면 되므로 계속 진행

-- 모니터 추가
기존에 사용하던 Monitor에 xpand4 추가
maxctrl link monitor xpand_monitor xpand4

모니터를 추가 하면 자동으로 service도 추가 되는데 안 될 경우,

maxctrl link service xpand_service xpand4   수행

-- 최종 확인

 

MaxScale 편집

 

기본으로 생성 되는 불 필요한 서버, 모니터, 서비스, 리스너 삭제

 

서버를 삭제 하려면 서버가 사용되고 있는 monitor와 service를 먼저 삭제 해야 하고,

service를 삭제 하려면 service를 사용하고 있는 리스너를 먼저 삭제 해야 한다.

 

그래서 모니터 --> 리스너 --> 서비스 --> 서버 순서로 삭제

 

-- 불필요한 서비스들 삭제

1. 모니터에서 server1과의 관계 삭제
maxctrl unlink monitor MariaDB-Monitor server1


2. 리스너 삭제 
maxctrl destroy listener Read-Write-Service Read-Write-Listener
maxctrl destroy listener Read-Only-Service Read-Only-Listener


3. 서비스에서 server1 과의 관계
maxctrl unlink service Read-Only-Service server1
maxctrl unlink service Read-Write-Service server1


4. 서비스와 모니터, 서버 삭제
maxctrl destroy service Read-Only-Servic
maxctrl destroy service Read-Write-Service
maxctrl destroy monitor MariaDB-Monitor
maxctrl destroy server server1

 

반응형

+ Recent posts