반응형

Xpand

 

Xpand를 설치 하게 되면 다음과 같은 기본 유저들이 생성 된다.

 

O/S 유저

    Xpand

        설치 시에 자동으로 xpand , xpandm 유저가 생성된다.

        SSH를 통한 node간에 접속이 있어야 하므로, 관리 편의 상 동일 O/S 패스워드 사용 권장

        xpand : mysql 기동 유저

        xpandm : 관리용 유저

 

DB 유저

    기본으로 생성 되는 유저

        root@127.0.0.1 : database administration

        xpand@localhost : xpand OS user account. Xpand process Managing.

        xpandm@localhost : xpandm OS user account. run "clx" command

 

Xpand Node 설치

 

최소 사양인 3대 노드를 설치 한다.

 

-- 공통 작업 (3개 노드 모두 진행)

 

-- /ect/hosts 설정 (root)
 
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:    cl90c9aff68a607030
Cluster Version: 5.3.14
Cluster Status:   OK
Cluster Size:    1 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 |  19.7M (0.10%) |  19.8G
----+----------+--------+---------------+-----+----------------+-------
                           10.70.101.16 |   0 |  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");

   

라이센스 입력 (1개 노드에서만 적용, 여기서는 xpand1에서 수행)

 

메일로 받은 트라이얼 라이센스나 정식 라이센스 입력

 

-- xpand 라이센스 적용 (하나의 node에서만 한다.)

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


SET GLOBAL license = '{"expiration": "2022-04-06 00:00:00", "company": "Goodusdata", "email": "xxxxxx@yyyyy.com", "person": "********", "signature": "302c02145eb31944ed5d5657a07a4de5fa85ed136e2d5902"}' ;

 

클러스터 설정( 라이센스 입력한 노드에서만 수행)

 

-- 클러스터 설정 (라이센스를 적용한 node에서만 한다.)

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


ALTER CLUSTER ADD '10.70.101.17', '10.70.101.18';


use system

select nodeid , hostname , iface_ip , mysql_port from nodeinfo ;   -- 3개 서버 정보가 보임

+--------+----------+--------------+------------+

| nodeid | hostname | iface_ip     | mysql_port |
+--------+----------+--------------+------------+
|      1 | xpand1   | 10.70.101.16 |       3306 |
|      3 | xpand3   | 10.70.101.18 |       3306 |
|      2 | xpand2   | 10.70.101.17 |       3306 |
+--------+----------+--------------+------------+
 
-- 클러스터 상태 확인

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

 
clx status
Cluster Name:    cl90c9aff68a607030
Cluster Version: 5.3.14
Cluster Status:   OK
Cluster Size:    3 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 |  20.2M (0.13%) |  14.9G
  2 |   xpand2 |    OK  |  10.70.101.17 |   0 |  14.8M (0.10%) |  14.9G
  3 |   xpand3 |    OK  |  10.70.101.18 |   0 |  14.7M (0.10%) |  14.9G
----+----------+--------+---------------+-----+----------------+-------
                                            0 |  49.6M (0.11%) |  44.6G

 

SSH키 복사

 

sudo grep -i -E "^PasswordAuthentication" /etc/ssh/sshd_config 명령어 수행 결과에 따라서 다르게 수행

    "PasswordAuthentication yes" 일 경우 ssh key가 자동 복사 되므로 node 1에서만 수행

    "PasswordAuthentication no" 일 경우 ssh key가 자동으로 복사 되지 않으므로 모든 노드에서 SSH Key 복사 필요

 

"PasswordAuthentication yes" 일 경우
 
su - xpand
clx pubkeyinstall
clx cmd date  (ssh key 정상 복사 유무테스트, 3개 서버의 현재 시간이 나와야 함)
exit
 
su - xpandm
clx pubkeyinstall
clx cmd date (ssh key 정상 복사 유무테스트, 3개 서버의 현재 시간이 나와야 함)
exit 
"PasswordAuthentication no" 일 경우

su - xpand

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub 해서 값 확인
3개 노드면 3개 노드 값을 모두 cpoy해서 3개 노드 모두 저장해 준다.
vi ~..ssh/autorized_keys 파일에 키 값 저장
chmod 600 ~/.ssh/authorized_keys
clx cmd date  (ssh key 정상 복사 유무테스트, 3개 서버의 현재 시간이 나와야 함)
 
su - xpandm
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub 해서 값 확인
3개 노드면 3개 노드 값을 모두 cpoy해서 3개 노드 모두 저장해 준다.
vi ~..ssh/autorized_keys 파일에 키 값 저장
chmod 600 ~/.ssh/authorized_keys
clx cmd date  (ssh key 정상 복사 유무테스트, 3개 서버의 현재 시간이 나와야 함)

 

MaxScale 모니터링용 DB계정 생성

 

클러스터가 묶인 상태이므로 아무 서버에서 한 번만 수행해 주면 된다.

(여기서는 maxscale 서버 아이피는 10.70.101.20 이다)

 

-- maxscale용 DB 유저 생성
 
mysql --user=root --password --no-auto-rehash
 
CREATE USER 'max'@'10.70.101.20' IDENTIFIED BY 'max1122';
GRANT SELECT ON system.membership TO 'max'@'10.70.101.20';
GRANT SELECT ON system.nodeinfo TO 'max'@'10.70.101.20';
GRANT SELECT ON system.softfailed_nodes TO 'max'@'10.70.101.20';
GRANT SELECT ON system.user_acl TO 'max'@'10.70.101.20';
GRANT SELECT ON system.users TO 'max'@'10.70.101.20';

 

Xpand Web 접속 확인

 

Xpand마다 기본적으로 모니터링 웹을 제공한다.  (기본 8080)

기본 값 :

    Email: noreply@mariadb.com
    Password: mariadb
    Target: localhost

 

 

기본 명령어들

 

clx [ dbstart | dbstop | restart | status | space | disk ]

 

[xpandm@xpand1 clustrix]$ clx status

Cluster Name:    cl36c9aa23ff872a40

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.51 |   0 |  402.1M (1.23%) |   31.9G
  2 |   xpand3 |    OK  |  10.70.101.53 |   0 |  429.1M (1.31%) |   31.9G
  3 |   xpand2 |    OK  |  10.70.101.52 |   0 |  377.5M (1.16%) |   31.9G
  4 |   xpand4 |    OK  |  10.70.101.54 |   0 |  449.9M (1.38%) |   31.9G
----+----------+--------+---------------+-----+-----------------+--------
                                            0 |    1.6G (1.27%) |  127.5G
 
[xpandm@xpand1 clustrix]$ clx space

nid | Hostname | Status |       Undo      |       Perm      |    Temp    |       Used      | DB Total | FS Free

----+----------+--------+-----------------+-----------------+------------+-----------------+----------+--------
  1 |   xpand1 |    OK  |  256.0K (0.00%) |  401.3M (1.23%) |  0 (0.00%) |  402.1M (1.23%) |    31.9G |    5.3G  <-- df 했을 O/S 남은 공간
  2 |   xpand3 |    OK  |  256.0K (0.00%) |  428.3M (1.31%) |  0 (0.00%) |  429.1M (1.31%) |    31.9G |    5.5G
  3 |   xpand2 |    OK  |  256.0K (0.00%) |  376.9M (1.15%) |  0 (0.00%) |  377.5M (1.16%) |    31.9G |    5.5G
  4 |   xpand4 |    OK  |  256.0K (0.00%) |  449.5M (1.38%) |  0 (0.00%) |  449.9M (1.38%) |    31.9G |    5.5G
----+----------+--------+-----------------+-----------------+------------+-----------------+----------+--------
                             1.0M (0.00%) |    1.6G (1.27%) |  0 (0.00%) |    1.6G (1.27%) |   127.5G |   21.8G
 
[xpandm@xpand1 clustrix]$ df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                  32G     0   32G   0% /dev
tmpfs                     32G  129M   32G   1% /dev/shm
tmpfs                     32G  9.0M   32G   1% /run
tmpfs                     32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/centos-root   81G  2.6G   74G   4% /
/dev/sdb2                 50G   55M   47G   1% /log
/dev/sdb1                 50G   42G  5.4G  89% /data
/dev/sda1                 10G  187M  9.9G   2% /boot
tmpfs                    6.3G     0  6.3G   0% /run/user/1000
tmpfs                    6.3G     0  6.3G   0% /run/user/0
 
[xpandm@xpand1 clustrix]$ clx disk

nid | Hostname | Status | Read IOPS | Write IOPS | Sync IOPS | Total IOPS

----+----------+--------+-----------+------------+-----------+-----------
  1 |   xpand1 |    OK  |      15.8 |        0.0 |       0.2 |       16.0
  2 |   xpand3 |    OK  |      16.0 |        0.0 |       0.0 |       16.0
  3 |   xpand2 |    OK  |      15.8 |        0.0 |       0.2 |       16.0
  4 |   xpand4 |    OK  |      16.0 |        0.0 |       0.2 |       16.2
----+----------+--------+-----------+------------+-----------+-----------
                               63.6 |        0.0 |       0.6 |       64.2

 

반응형

+ Recent posts