Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.5.9-MariaDB-1:10.5.9+maria~focal-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 2098 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.5.9-MariaDB-1:10.5.9+maria~focal mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> stop slave;
MariaDB [(none)]> CHANGE MASTER TO
-> MASTER_HOST='###.###.###.###',
-> MASTER_PORT=3306,
-> MASTER_USER='repl',
-> MASTER_PASSWORD='1234',
-> MASTER_LOG_FILE='mysql-bin.000001',
-> MASTER_LOG_POS=2098;
MariaDB [(none)]> start slave;
MariaDB [(none)]> show slave status \G;
* 1. row *
Slave_IO_State: Waiting for master to send event
Master_Host: ###.###.###.###
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 2098
Relay_Log_File: mysql-relay-bin.000002
Relay_Log_Pos: 906
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 2098
Relay_Log_Space: 1215
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Slave_DDL_Groups: 3
Slave_Non_Transactional_Groups: 0
Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
ERROR: No query specified
MariaDB [(none)]>
운영체제를 선택하고 zabbix 서버버전을 확인해서 에이전트를 선택하면, 아래쪽에 다운로드 링크가 나타난다
서버에 에이전트 다운로드
cd /usr/local
mkdir zabbix-agent
cd zabbix-agent
wget https://cdn.zabbix.com/zabbix/binaries/stable/5.0/5.0.10/zabbix_agent-5.0.10-linux-3.0-amd64-static.tar.gz
에이전트 설치
tar xfzp zabbix_agent-5.0.10-linux-3.0-amd64-static.tar.gz
zabbiz 유저추가
sudo useradd -r -s /bin/false zabbix
환경설정파일 복사
cd /usr/local/etc
ln -s /usr/local/zabbiz-agent/conf/zabbix_agentd.conf .
에이전트가 시작할 때 -t 옵션을 사용해서 설정파일을 지정하지 않으면, /usr/local/etc/zabbix_agentd.conf 파일을 찾는다. 때문에 해당위치에 파일을 링크로 걸어둔다. 직접 환경설정파일을 지정하려면 -t 옵션을 사용한다.
zabbiz_agentd.conf 설정파일 수정
# 로그파일위치를 변경
LogFile=/tmp/zabbix_agentd.log
# Zabbix 서버아이피로 변경
Server=127.0.0.1
에이전트 시작하기
cd /usr/local/zabbix-agent/sbin
./zabbix_agentd
우분투에서 시작스크립트에 등록
cd /etc/init.d
ln -s /usr/local/zabbix-agent/sbin/zabbix_agentd .
방화벽 설정
iptables -A INPUT -s {server ip} -p tcp -m tcp --dport 10050 -j ACCEPT
iptables -A INPUT -s {server ip} -p tcp -m tcp --dport 10051 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 10050 -j DROP
iptables -A INPUT -p tcp -m tcp --dport 10051 -j DROP