国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

安裝配置patroni

IT那活兒 / 1774人閱讀
安裝配置patroni

點擊上方“IT那活兒”,關注后了解更多內容,不管IT什么活兒,干就完了!!!



機器分配

10.37.129.3 node1

10.37.129.4 node2

10.37.129.5 node3

10.37.129.6 node-vip



源碼包安裝

python3 setup.py build

python3 setup.py install



軟件包安裝  

--all nodes

--標準配置:

firewalld

selinux

chrony

gcc

libpq5-devel

--PostgreSQL數據庫安裝:

postgresql12

postgresql12-server

postgresql12-libs

postgresql12-contrib

--patroni軟件需要:

etcd

python3

python3-devel




配置sudo權限


visudo

#
# Allow root to run any commands anywhere

postgres ALL=(root) NOPASSWD: ALL




ETCD集群安裝配置  

--all nodes

--查看etcd狀態:

export ETCDCTL_API=3

export ENDPOINTS=http://10.37.129.4 :2379,http://10.37.129.5 :2379,http://10.37.129.3 :2379

etcdctl endpoint status --endpoints=$ENDPOINTS -w=table

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

| ENDPOINT |         ID | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |

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

| http://10.37.129.4 :2379 | 49bab10dd5347fa2 | 3.3.11 |   20 kB | false |        105 | 9 |

| http://10.37.129.5 :2379 | 97cdb5480a6be19f | 3.3.11 |   20 kB | false |        105 | 9 |

| http://10.37.129.3 :2379 | a2916ae27f29d955 | 3.3.11 |   20 kB | true |        105 | 9 |

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




軟件WATCHDOG安裝配置


--all nodes


# 安裝軟件,linux內置功能
yum install -y watchdog

# 初始化watchdog字符設備
modprobe softdog

# 修改/dev/watchdog設備權限
chmod 666 /dev/watchdog

# 啟動watchdog服務
systemctl start watchdog
systemctl enable watchdog




partroni軟件安裝  

--all nodes

pip3 install psycopg2==2.8.6

pip3 install patroni[etcd]




創建patroni.service服務


 --all nodes


vi /usr/lib/systemd/system/patroni.service

[Unit]

Description=Runners to orchestrate a high-availability PostgreSQL

After=syslog.target network.target etcd.service

[Service]

Type=simple

User=postgres

Group=postgres

EnvironmentFile=-/etc/patroni/patroni_env.conf

ExecStartPre=-/usr/bin/sudo /sbin/modprobe softdog

ExecStartPre=-/usr/bin/sudo /bin/chown postgres /dev/watchdog

ExecStart=/usr/bin/env patroni /etc/patroni/patroni.yml

ExecReload=/bin/kill -s HUP $MAINPID

KillMode=process

TimeoutSec=30

Restart=on-failure

[Install]

WantedBy=multi-user.target

systemctl daemon-reload




修改配置文件  


--all nodes

--yaml文件不能使用制表位。

vi /etc/patroni/patroni.yml

scope: pgsql

namespace: /service/

name: pg1

restapi:

listen: 0.0.0.0 :8008

connect_address: 10.37.129.3:8008

etcd:

hosts: 10.37.129.3:2379,10.37.129.4:2379,10.37.129.5:2379

bootstrap:

dcs:

ttl: 30

loop_wait: 10

retry_timeout: 10

maximum_lag_on_failover: 1048576

master_start_timeout: 300

synchronous_mode: false

synchronous_node_count: 2 #同步備用服務器數量為2

synchronous_mode_strict: false #沒有可用備用同步服務器情況下,阻塞主服務器會話

postgresql:

use_pg_rewind: true

use_slots: true

parameters:

listen_addresses: "0.0.0.0"

port: 5432

wal_level: replica

hot_standby: "on"

wal_keep_segments: 100

max_wal_senders: 10

max_replication_slots: 10

wal_log_hints: "on"

archive_mode: "on"

archive_timeout: 1800s

archive_command: mkdir -p . ./wal_archive && test ! -f . ./wal_archive/%f && cp %p . ./wal_archive/%f

recovery_conf:

restore_command: cp ../wal_archive/%f %p

initdb:

- encoding: UTF8

- locale: C

- lc-ctype: zh_CN.UTF-8

- data-checksums

pg_hba:

- host replication postgres 10.37.129.0/24 md5

- host all all 0.0.0.0/0 md5

postgresql:

listen: 0.0.0.0 :5432

connect_address: 10.37.129.3 :5432

data_dir: /var/lib/pgsql/12/data

bin_dir: /usr/pgsql-12/bin

authentication:

replication:

username:

postgres

"123456"

postgres

"123456"

postgres

"123456"

password:

superuser:

username:

password:

rewind:

username:

password:

basebackup:

max-rate: 100M

checkpoint: fast

watchdog:

mode: automatic # Allowed values: off, automatic, required

device: /dev/watchdog

safety_margin: 5

tags:

nofailover: false

noloadbalance: false

clonefrom: false

nosync: false




啟動patroni服務  

--all nodes

systemctl enable patroni

systemctl start patroni




查看patroni集群狀態


patronictl -c /etc/patroni/patroni.yml list

+ Cluster: pgsql (6942330619575798728) ----+----+-----------+

| Member | Host | Role | State | TL | Lag in MB |

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

|
 pg1

| pg2

|
 pg3

|

0 |


0 |

|
 10.37.129.3 | Leader | running | 1 |

| 10.37.129.4 | Replica | running |  1 |

|
 10.37.129.5 | Replica | running | 1 |




通過web查看集群信息

http://10.37.129.3:8008/patroni


文章參考鏈接:http://blog.itpub.net/30496307/viewspace-2764349/


本文作者:陳輝耀

本文來源:IT那活兒(上海新炬王翦團隊)

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129572.html

相關文章

發表評論

0條評論

IT那活兒

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<