728x90
아래와 같이 PG stanby 서버 ssh 로그인이 느린 문제가 발생
때문에 failover 가 일어날 당시 pgool을 통한 online recovery 가 상당히 느려지는 문제점이 발생
( 초기 basebackup 또한 상당한 시간이 걸렸다 )
-v 옵션을 주고 ssh 로 standby 서버에 로그인을 시도해보니 마지막 부분에서 시간이 많이 걸리는 것을 알 수 있었다.
[postgres@postgres-ha1 ssh]$ ssh -v postgres@192.168.126.5
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 192.168.126.5 [192.168.126.5] port 22.
debug1: Connection established.
debug1: identity file /home/postgres/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/postgres/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.126.5:22 as 'postgres'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:d2SLRQ9JOv/a9p/FzQ1NBnAVvqcKNmR3uLUQWX6IML4
debug1: Host '192.168.126.5' is known and matches the ECDSA host key.
debug1: Found key in /home/postgres/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
...
...
구글링을 해보니 /etc/ssh/ssd_config 파일의 UseDNS 부분의 주석처리를 해제하고 no 로 바꾸어 주면 해결된다는 것을 찾았다.
이 파라미터를 on으로 설정해 놓으면 SSH 접속 시 DNS Lookup을 하여, DNS를 찾지 못하는 경우 일정시간 대기 후 타임아웃이 발생 한다. 즉, ssh 지연 원인은 DNS 설정이 되어 있지 않고, sshd_config 파일의 UseDNS 항목이 yes 또는 주석 처리되어 있을 때 발생!
파라미터 변경 후 ssh 데몬을 재실행 해준다.
service sshd restart
다시 ssh 를 통해 standby 서버로 로그인해보니 어떤 딜레이도 없이 로그인 완료!
728x90
반응형
'OS > Linux' 카테고리의 다른 글
[Linux] top 명령어 (0) | 2023.01.19 |
---|---|
[Linux] kernal memory 영역 (0) | 2023.01.19 |
[Linux] 정렬과 중복 처리 (sort, uniq) (0) | 2022.12.05 |
[Linux]압축 명령어 모음 (0) | 2022.04.22 |
[Linux]CentOS 설치 후 초기 세팅 및 명령어 알아보기 (0) | 2022.04.22 |