hghac和hgproxy版本升級相關操作和注意事項

文章目錄

  • 環境
  • 文檔用途
  • 詳細信息

環境

系統平臺:N/A
版本:4.5.6,4.5.7,4.5.8

文檔用途

本文檔用于高可用集群環境中hghac組件和hgproxy組件替換和升級操作

詳細信息

1.關閉服務
所有數據節點都執行

1、關閉hgproxy服務

[root@hgdb01 tools]# systemctl stop hgproxy.service
[root@hgdb02 tools]# systemctl stop hgproxy.service

2、關閉hghac服務

[root@hgdb01 tools]# systemctl stop hghac.service
[root@hgdb02 tools]# systemctl stop hghac.service

3、關閉etcd服務

[root@hgdb01 tools]# systemctl stop etcd.service
[root@hgdb02 tools]# systemctl stop etcd.service
[root@localhost ~]# systemctl stop etcd.service

2.升級過程
操作前請先備份原集群配置文件。

1、安裝軟件包
驗證md5值

[root@hgdb01 tools]# md5sum hghac4.2.3.3-see-17f931d-20240620.x86_64.rpm
0d960d0ac4925b272c30849e415031fd  hghac4.2.3.3-see-17f931d-20240620.x86_64.rpm

安裝軟件包

[root@hgdb01 tools]# rpm -ivh hghac4.2.3.3-see-17f931d-20240620.x86_64.rpm 
準備中...                          ################################# [100%]
正在升級/安裝...
1:hghac-4.2.3.3-17f931d            ################################# [100%]
Created symlink from /etc/systemd/system/multi-user.target.wants/hghac.service to /usr/lib/systemd/system/hghac.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /usr/lib/systemd/system/etcd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/vip-manager.service to /usr/lib/systemd/system/vip-manager.service.

2、配置并啟動etcd
01節點:

[root@hgdb01 tools]# vim /usr/local/hghac/etcd/etcd.yml 
# This is the configuration file for the etcd server.# Human-readable name for this member.
name: 'etcd_01'# Path to the data directory.
data-dir: /usr/local/hghac/etcd/etcd01# Path to the dedicated wal directory.
wal-dir:# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100# Time (in milliseconds) for an election to timeout.
election-timeout: 1000# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://x.x.0.101:2380# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://x.x.0.101:2379,http://127.0.0.1:2379# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://x.x.0.101:2380# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://x.x.0.101:2379# Discovery URL used to bootstrap the cluster.
discovery:# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'# HTTP proxy to use for traffic to discovery service.
discovery-proxy:# DNS domain used to bootstrap initial cluster.
discovery-srv:# Initial cluster configuration for bootstrapping.
initial-cluster: etcd_01=http://x.x.0.101:2380,etcd_02=http://x.x.0.102:2380,etcd_03=http://x.x.0.103:2380# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false# Accept etcd V2 client requests
enable-v2: true# Enable runtime profiling data via HTTP server
enable-pprof: false# Valid values include 'on', 'readonly', 'off'
proxy: 'off'# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0client-transport-security:# DEPRECATED: Path to the client server TLS CA file.ca-file:# Path to the client server TLS cert file.cert-file:# Path to the client server TLS key file.key-file:# Enable client cert authentication.client-cert-auth: false# Path to the client server TLS trusted CA cert file.trusted-ca-file:# Client TLS using generated certificatesauto-tls: falsepeer-transport-security:# DEPRECATED: Path to the peer server TLS CA file.ca-file:# Path to the peer server TLS cert file.cert-file:# Path to the peer server TLS key file.key-file:# Enable peer client cert authentication.peer-client-cert-auth: false# Path to the peer server TLS trusted CA cert file.trusted-ca-file:# Peer TLS using generated certificates.auto-tls: false# Enable debug-level logging for etcd.
debug: false# Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG'.
log-package-levels:# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-output: default# Force to create a new one member cluster.
force-new-cluster: false

02節點配置

# This is the configuration file for the etcd server.# Human-readable name for this member.
name: 'etcd_02'# Path to the data directory.
data-dir: /usr/local/hghac/etcd/etcd02# Path to the dedicated wal directory.
wal-dir:# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100# Time (in milliseconds) for an election to timeout.
election-timeout: 1000# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://x.x.0.102:2380# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://x.x.0.102:2379,http://127.0.0.1:2379# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://x.x.0.102:2380# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://x.x.0.102:2379# Discovery URL used to bootstrap the cluster.
discovery:# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'# HTTP proxy to use for traffic to discovery service.
discovery-proxy:# DNS domain used to bootstrap initial cluster.
discovery-srv:# Initial cluster configuration for bootstrapping.
initial-cluster: etcd_01=http://x.x.0.101:2380,etcd_02=http://x.x.0.102:2380,etcd_03=http://x.x.0.103:2380# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false# Accept etcd V2 client requests
enable-v2: true# Enable runtime profiling data via HTTP server
enable-pprof: false# Valid values include 'on', 'readonly', 'off'
proxy: 'off'# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0client-transport-security:# DEPRECATED: Path to the client server TLS CA file.ca-file:# Path to the client server TLS cert file.cert-file:# Path to the client server TLS key file.key-file:# Enable client cert authentication.client-cert-auth: false# Path to the client server TLS trusted CA cert file.trusted-ca-file:# Client TLS using generated certificatesauto-tls: falsepeer-transport-security:# DEPRECATED: Path to the peer server TLS CA file.ca-file:# Path to the peer server TLS cert file.cert-file:# Path to the peer server TLS key file.key-file:# Enable peer client cert authentication.peer-client-cert-auth: false# Path to the peer server TLS trusted CA cert file.trusted-ca-file:# Peer TLS using generated certificates.auto-tls: false# Enable debug-level logging for etcd.
debug: false# Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG'.
log-package-levels:# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-output: default# Force to create a new one member cluster.
force-new-cluster: false

03節點配置

# This is the configuration file for the etcd server.# Human-readable name for this member.
name: 'etcd_03'# Path to the data directory.
data-dir: /usr/local/hghac/etcd/etcd03# Path to the dedicated wal directory.
wal-dir:# Number of committed transactions to trigger a snapshot to disk.
snapshot-count: 10000# Time (in milliseconds) of a heartbeat interval.
heartbeat-interval: 100# Time (in milliseconds) for an election to timeout.
election-timeout: 1000# Raise alarms when backend size exceeds the given quota. 0 means use the
# default quota.
quota-backend-bytes: 0# List of comma separated URLs to listen on for peer traffic.
listen-peer-urls: http://x.x.0.103:2380# List of comma separated URLs to listen on for client traffic.
listen-client-urls: http://x.x.0.103:2379,http://127.0.0.1:2379# Maximum number of snapshot files to retain (0 is unlimited).
max-snapshots: 5# Maximum number of wal files to retain (0 is unlimited).
max-wals: 5# Comma-separated white list of origins for CORS (cross-origin resource sharing).
cors:# List of this member's peer URLs to advertise to the rest of the cluster.
# The URLs needed to be a comma-separated list.
initial-advertise-peer-urls: http://x.x.0.103:2380# List of this member's client URLs to advertise to the public.
# The URLs needed to be a comma-separated list.
advertise-client-urls: http://x.x.0.103:2379# Discovery URL used to bootstrap the cluster.
discovery:# Valid values include 'exit', 'proxy'
discovery-fallback: 'proxy'# HTTP proxy to use for traffic to discovery service.
discovery-proxy:# DNS domain used to bootstrap initial cluster.
discovery-srv:# Initial cluster configuration for bootstrapping.
initial-cluster: etcd_01=http://x.x.0.101:2380,etcd_02=http://x.x.0.102:2380,etcd_03=http://x.x.0.103:2380# Initial cluster token for the etcd cluster during bootstrap.
initial-cluster-token: 'etcd-cluster'# Initial cluster state ('new' or 'existing').
initial-cluster-state: 'new'# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false# Accept etcd V2 client requests
enable-v2: true# Enable runtime profiling data via HTTP server
enable-pprof: false# Valid values include 'on', 'readonly', 'off'
proxy: 'off'# Time (in milliseconds) an endpoint will be held in a failed state.
proxy-failure-wait: 5000# Time (in milliseconds) of the endpoints refresh interval.
proxy-refresh-interval: 30000# Time (in milliseconds) for a dial to timeout.
proxy-dial-timeout: 1000# Time (in milliseconds) for a write to timeout.
proxy-write-timeout: 5000# Time (in milliseconds) for a read to timeout.
proxy-read-timeout: 0client-transport-security:# DEPRECATED: Path to the client server TLS CA file.ca-file:# Path to the client server TLS cert file.cert-file:# Path to the client server TLS key file.key-file:# Enable client cert authentication.client-cert-auth: false# Path to the client server TLS trusted CA cert file.trusted-ca-file:# Client TLS using generated certificatesauto-tls: falsepeer-transport-security:# DEPRECATED: Path to the peer server TLS CA file.ca-file:# Path to the peer server TLS cert file.cert-file:# Path to the peer server TLS key file.key-file:# Enable peer client cert authentication.peer-client-cert-auth: false# Path to the peer server TLS trusted CA cert file.trusted-ca-file:# Peer TLS using generated certificates.auto-tls: false# Enable debug-level logging for etcd.
debug: false# Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG'.
log-package-levels:# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd.
log-output: default# Force to create a new one member cluster.
force-new-cluster: false

啟動etcd(三臺間隔時間不要太長)

[root@hgdb01 ~]# systemctl  start  etcd.service
[root@hgdb02 ~]# systemctl  start  etcd.service
[root@hgdb03 ~]# systemctl  start  etcd.service

查看etcd集群狀態

[root@hgdb01 tools]# /usr/local/hghac/etcd/etcdctl  --endpoints=http://x.x.0.101:2379,http://x.x.0.102:2379,http://x.x.0.103:2379 endpoint status --write-out=table
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|          ENDPOINT          |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| http://x.x.0.101:2379  | 7a586afca670fdcd |  3.4.15 |   20 kB |     false |      false |         2 |          8 |                  8 |        |
| http://x.x.0.102:2379  |  5506b0263532a5d |  3.4.15 |   25 kB |     false |      false |         2 |          8 |                  8 |        |
| http://x.x.0.103:2379  | 21d26eb730319e20 |  3.4.15 |   25 kB |      true |      false |         2 |          8 |                  8 |        |
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

3、配置hghac組件
01節點

scope: highgo-see-cluster
namespace: /service/
name: see_01 restapi:listen: x.x.0.101:8008connect_address: x.x.0.101:8008etcd3:hosts: x.x.0.101:2379,x.x.0.102:2379,x.x.0.103:2379#zookeeper:
#  hosts: ['x.x.31.101:2181', 'x.x.31.102:2181', 'x.x.31.103:2181']bootstrap:dcs:ttl: 30loop_wait: 10retry_timeout: 10maximum_lag_on_failover: 1048576master_start_timeout: 300synchronous_mode: falsepostgresql:use_pg_rewind: trueparameters:wal_level: replicahot_standby: "on"wal_keep_size: 100max_wal_senders: 10max_replication_slots: 10wal_log_hints: "on"archive_mode: "off"archive_timeout: 1800slogging_collector: "on"method: initdb_keygeninitdb_keygen:command: /usr/local/hghac/hac/initdb_keygen.shkeep_existing_recovery_conf: Trueno_params: Truepostgresql:database: highgolisten: 0.0.0.0:5866connect_address: x.x.0.101:5866bin_dir: /opt/highgo/hgdb-see-4.5.8/bindata_dir: /data/highgo/dataconfig_dir: /data/highgo/datapgpass: /tmp/.pgpassauthentication:replication:username: sysdbapassword: Hello@1234rewind:username: sysdbapassword: Hello@1234sysdba:password: Hello@1234syssso:password: Hello@1234syssao:password: Hello@1234parameters:ssl: 'on'ssl_cert_file: /data/highgo/data/server.crtssl_key_file: /data/highgo/data/server.keypg_hba:- local   all             all                                     sm3- host    all             all             0.0.0.0/0               sm3- host    all             all             ::1/128                 sm3- local   replication     all                                     sm3- host    replication     all             0.0.0.0/0               sm3- host    replication     all             ::1/128                 sm3tags:nofailover: falsenoloadbalance: falseclonefrom: falsenosync: falselog:level: INFOtraceback_level: INFOdir: /usr/local/hghac/hac

啟動hghac

# systemctl start hgahc.service

查看集群狀態

# /usr/local/hghac/hac/hghactl/hghactl -c /usr/local/hghac/hac/hghac.yml list

02節點

scope: highgo-see-cluster
namespace: /service/
name: see_02 restapi:listen: x.x.0.102:8008connect_address: x.x.0.102:8008etcd3:hosts: x.x.0.101:2379,x.x.0.102:2379,x.x.0.103:2379#zookeeper:
#  hosts: ['x.x.31.101:2181', 'x.x.31.102:2181', 'x.x.31.103:2181']bootstrap:dcs:ttl: 30loop_wait: 10retry_timeout: 10maximum_lag_on_failover: 1048576master_start_timeout: 300synchronous_mode: falsepostgresql:use_pg_rewind: trueparameters:wal_level: replicahot_standby: "on"wal_keep_size: 100max_wal_senders: 10max_replication_slots: 10wal_log_hints: "on"archive_mode: "off"archive_timeout: 1800slogging_collector: "on"method: initdb_keygeninitdb_keygen:command: /usr/local/hghac/hac/initdb_keygen.shkeep_existing_recovery_conf: Trueno_params: Truepostgresql:database: highgolisten: 0.0.0.0:5866connect_address: x.x.0.102:5866bin_dir: /opt/highgo/hgdb-see-4.5.8/bindata_dir: /data/highgo/dataconfig_dir: /data/highgo/datapgpass: /tmp/.pgpassauthentication:replication:username: sysdbapassword: Hello@1234rewind:username: sysdbapassword: Hello@1234sysdba:password: Hello@1234syssso:password: Hello@1234syssao:password: Hello@1234parameters:ssl: 'on'ssl_cert_file: /data/highgo/data/server.crtssl_key_file: /data/highgo/data/server.keypg_hba:- local   all             all                                     sm3- host    all             all             0.0.0.0/0               sm3- host    all             all             ::1/128                 sm3- local   replication     all                                     sm3- host    replication     all             0.0.0.0/0               sm3- host    replication     all             ::1/128                 sm3tags:nofailover: falsenoloadbalance: falseclonefrom: falsenosync: falselog:level: INFOtraceback_level: INFOdir: /usr/local/hghac/hac

啟動hghac

# systemctl start hgahc.service

查看集群狀態

# /usr/local/hghac/hac/hghactl/hghactl -c /usr/local/hghac/hac/hghac.yml list

4、配置hgproxy
所有節點配置相同

[root@hgdb01 hgproxy]# cat  /usr/local/hgproxy/etc/proxy.conf
# version: 4.0.27[Log]
log_collector       = on# 是否開始日志功能log_level           = log#  可選日志級別如下:#    debug5#    debug4#    debug3#    debug2    - 顯示設置路由節點的關鍵點#    debug1    - 顯示語句與協議包的路由節點#    log       - 顯示會話的開始與結束#    commerror#    info#    notice#    warning#    error#    fatal#    paniclog_destination     = file# stdout: 標準輸出# stderr:  標準錯誤輸出# file:    輸出到文件log_filename        = /data/hglog/hgproxy.log# 日志輸出文件# 設置按日期輸出到不同文件, 只需要在文件名中添加時間轉換字符 %d(%Y%m%d), 例如:/tmp/log/hgproxy.%d(%Y%m%d).log, 輸出文件名樣式為:hgproxy.20200808.loglog_format          = "%d.%us %-7V [pid:%-7p cid:%-7U %18F:%-5L] %m%n"# 格式說明:# %d           :時間格式(2012-01-01 17:03:12)# %d.%ms       :時間格式(2012-01-01 17:03:12.123)# %d.%us       :時間格式(2012-01-01 17:03:12.123456)# %m           :用戶日志(必須)# %n           :換行符(必須)# %p           :進程id# %t           :線程id# %U           :協程id# %V           :日志級別,大寫# %v           :日志級別,小寫# %F           :源代碼文件名# %L           :源代碼行數log_rotation_size   = 500MB# 日志文件自動轉存大小(轉存文件后綴數字越大,日志時間越新).# 設置為0, 則關閉此功能.log_max_rotation_file_num = 0# 轉存文件最大保留個數(設置的值大于1時, 此功能生效).# 當轉存文件達到設置的個數時,依次自動刪除最舊的文件.# 當日志文件比較重要時,請謹慎決定是否打開此功能.[Proxy]
listen_addresses    = *
port                = 5888
socket_dir          = /tmpprocess_nums        = 0# 負責處理會話的進程個數(建議設置為服務器核心數; 設置為0時, 自動獲取CPU核心數進行設置)session_balance     = on# 以輪詢的的方式使進程間處理的會話盡量均衡process_bind_cpu    = off# 負責處理會話的進程, 是否綁定CPU運行extension_module    = librwsplit.so# hgproxy擴展模塊, 目前只有讀寫分離模塊,默認即可auto_replace_application_name  = "hgproxy: app[__IP__:__PORT__:__ORIGINAL__]"# 自動修改 application_name 參數.# __IP__       : 應用的IP.# __PORT__     : 應用的端口.# __ORIGINAL__ : 原始數據.# 注意:由于數據庫限制,開啟此功能后,hgproxy會添加額外的信息,因此應用可自定義設置的 application_name 字符串會減少。# 參數值設置為空,則關閉此功能use_mctx = off# 使用內存上下文機制管理內存transaction_mode = Auto# Auto     事務內會進行讀寫分離,路由節點自動判斷# Primary  事務內不進行讀寫分離,固定發往主節點read_write_separation = on# 讀寫分離開關# 該配置項支持使用 proxy_ctl reloadcfg 生效,無需重啟[BackendNode]
node_num            = 2# 后端節點數量load_balancing_mode = 1# 負載均衡模式(目前只有一種模式,默認即可)# 1:權重模式startup_check       = off# 啟動時, 檢查配置的數據庫是否能夠連接hostname0           = x.x.0.101
port0               = 5866
backend_weigh0      = 1# hostnameN        第N個節點IP# portN            第N個節點端口# backend_weightN  第N個節點權重比hostname1           = x.x.0.102
port1               = 5866
backend_weigh1      = 1#hostname2           = 127.0.0.1
#port2               = 5868
#backend_weigh2      = 1read_timeout_close  = 0# 當讀取數據庫超時自動斷開連接.# 此值不能設置為負數,設置的值大于0時, 此功能生效.# 單位:秒,取值最大為604800(一周)standby_additional_check = "select count(pid) > 0 from pg_stat_wal_receiver;"# 備節點額外的檢測# 請確保該SQL的返回結果為單行單列,且值為 t 或 f;[Replication]streaming_replication_delay_time    = 100000# 假設流復制延遲時間, 單位: 微秒# 設置為 0 則關閉此功能# 取值范圍: 0 - 3600000000(1小時)[DatabaseCheck]lifecheck_user      = sysdba# 用于檢測時的用戶名lifecheck_dbname    = highgo# 用于檢測時的數據庫lifecheck_time      = 10# 連接間隔時間,取值范圍 1 - 3600, 單位:秒lifecheck_num       = 3# 連續連接失敗指定次數,達到該次數,節點將置為異常, 取值范圍 1 - 10[routing]
null_query_routing = both# 空語句發送的節點: primary/standby/both# 該配置項支持使用 proxy_ctl reloadcfg 生效,無需重啟regex_routing_file  =# 正則路由配置文件,配置模板文件見 etc/regex_routing_settings.json# 注意事項:請配置 json 文件絕對路徑# 該配置項支持使用 proxy_ctl reloadcfg 生效,無需重啟routing_unnamed_parse_to_both = no# 未命名的 parse 協議是否發送到雙節點# 該配置項支持使用 proxy_ctl reloadcfg 生效,無需重啟[BlackList]# 此配置參數未來會移除,建議使用 regex_routing_file 配置
ignore_regex_case               = off# on:  匹配時忽略大小寫# off: 匹配時不忽略大小寫# 此配置參數未來會移除,建議使用 regex_routing_file 配置
black_regex_token_list          =# 匹配到了發往主節點# 此配置參數未來會移除,建議使用 regex_routing_file 配置
white_regex_token_list          =# 匹配成功發往備節點object_relationship_list        = /usr/local/hgproxy/etc/object_relationship_list.json[watchdog]server_watchdog                 = on# 檢測 hgproxy 端口是否可以連接server_watchdog_interval        = 30# 檢測時間間隔(秒)# 取值范圍: 1 - 3600server_watchdog_auto_restart    = on# 檢測 hgproxy 端口不可用后, 是否自動重啟 hgproxy.server_watchdog_failed_count    = 3# 連續失敗次數, 達到該計數后,# 如果 server_watchdog_auto_restart 為 on, 則會自動重啟 hgproxy# 取值范圍: 1 - 3600status_watchdog                 = on# 內部統計打印日志輸出status_watchdog_interval        = 60# 內部統計打印日志輸出時間間隔(秒)# 取值范圍: 1 - 3600status_watchdog_pretty_log      = off# 是否對日志輸出進行美化處理[SSL]
ssl_switch                = offssl_cert                  = /usr/local/hgproxy/etc/server.crt
ssl_key                   = /usr/local/hgproxy/etc/server.key
ssl_ca_cert               = /usr/local/hgproxy/etc/root.crt
ssl_ca_cert_dir           = /usr/local/hgproxy/etcssl_ciphers               = HIGH:MEDIUM:+3DES:!aNULL
ssl_prefer_server_ciphers = on
ssl_ecdh_curve            = prime256v1
ssl_dh_params_file        =[admin]virtual_database                = hgproxy# 虛擬數據庫, 無需數據中存在virtual_user                    = hgproxy# 虛擬用戶, 無需數據中存在virtual_user_auth_method        = password# 可選取值: "md5", "password"virtual_user_password           = hgproxy@123# 如果 virtual_user_auth_method 配置為 md5,# md5密碼生成方法: echo -n "123456hgproxy" | md5sum# 123456 是登錄密碼, hgproxy 是 virtual_user 配置的用戶名

拷貝ssl證書文件

[root@xxdb01 etc]# cp  /data/highgo/data/server.*   /opt/HighGo/tools/hgproxy/etc/
[root@xxdb01 etc]# cp  /data/highgo/data/root.crt   /opt/HighGo/tools/hgproxy/etc/

初始化hgproxy

[root@hgdb01 etc]# /usr/local/hgproxy/bin/proxy_ctl  init -h x.x.0.101 -U sysdba -d highgo -p 5866
ip       == [x.x.0.101]
port     == [5866]
database == [highgo]
username == [sysdba]please enter password:
init successfully

啟動服務

[root@xxdb01 etc]# systemctl start hgproxy

驗證登錄

[root@xxdb01 etc]# psql highgo sysdba -p 5888

3.注意事項
1、如果用的是tar包安裝,etcd.service和hghac.service需要手動拷貝到/usr/lib/systemd/system/文件夾下

# cp /usr/local/hghac/etcd/etcd.service /usr/lib/systemd/system/
# cp /usr/local/hghac/hac/hghac.service /usr/lib/systemd/system/
# systemctl daemon-reload

2、關閉服務時先停止hghac.service,再關閉etcd.service,防止數據庫都變成備庫模式。

3、注意備份原集群配置文件,參數盡量保持與原配置相同。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/81273.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/81273.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/81273.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

userfaultfd內核線程D狀態問題排查

問題現象 運維反應機器上出現了很多D狀態進程,也kill不掉,然后將現場保留下來進行排查。 排查過程 都是內核線程,先看下內核棧D在哪了,發現D在了userfaultfd的pagefault流程。 uffd知識補充 uffd探究 uffd在firecracker與e2b的架構下使…

深入解析:構建高性能異步HTTP客戶端的工程實踐

一、架構設計原理與核心優勢 HTTP/2多路復用技術的本質是通過單一的TCP連接并行處理多個請求/響應流,突破了HTTP/1.1的隊頭阻塞限制。在異步編程模型下,這種特性與事件循環機制完美結合,形成了高性能網絡通信的黃金組合。相較于傳統同步客戶…

根據臺賬批量制作個人表

1. 前期材料準備 1)要有 人員總的信息臺賬 2)要有 個人明白卡模板 2. 開始操作 1)打開 人員總的信息臺賬,選擇所需要的數據模塊; 2)點擊插入,選擇數據透視表,按流程操作&…

《AI大模型應知應會100篇》第65篇:基于大模型的文檔問答系統實現

第65篇:基于大模型的文檔問答系統實現 📚 摘要:本文詳解如何構建一個基于大語言模型(LLM)的文檔問答系統,支持用戶上傳 PDF 或 Word 文檔,并根據其內容進行智能問答。從文檔解析、向量化、存儲到…

RTK哪個品牌好?2025年RTK主流品牌深度解析

在測繪領域,RTK 技術的發展日新月異,選擇一款性能卓越、穩定可靠的 RTK 設備至關重要。2025 年,市場上涌現出眾多優秀品牌,本文將深入解析幾大主流品牌的核心競爭力。 華測導航(CHCNAV):技術創…

SpringCloud微服務開發與實戰

本節內容帶你認識什么是微服務的特點,微服務的拆分,會使用Nacos實現服務治理,會使用OpenFeign實現遠程調用(通過黑馬商城來帶你了解實際開發中微服務項目) 前言:從谷歌搜索指數來看,國內從自201…

pgsql14自動創建表分區

最近有pgsql的分區表功能需求,沒想到都2025年了,pgsql和mysql還是沒有自身支持自動創建分區表的功能 現在pgsql數據庫層面還是只能用老三樣的辦法來處理這個問題,每個方法各有優劣 1. 觸發器 這是最傳統的方法,通過創建一個觸發…

math toolkit for real-time development讀書筆記一三角函數快速計算(1)

一、基礎知識 根據高中知識我們知道,很多函數都可以用泰勒級數展開。正余弦泰勒級數展開如下: 將其進一步抽象為公式可知: 正弦和余弦的泰勒級數具有高度結構化的模式,可拆解為以下核心特征: 1. 符號交替特性 正弦級…

uni-app 中適配 App 平臺

文章目錄 前言? 1. App 使用的 Runtime 架構:**WebView 原生容器(plus runtime)**📌 技術棧核心: ? 2. WebView Native 的通信機制詳解(JSBridge)📤 Web → Native 調用&#xf…

SpringBoot基礎(靜態資源導入)

靜態資源導入 在WebMvcAutoConfiguration自動配置類中 有一個添加資源的方法: public void addResourceHandlers(ResourceHandlerRegistry registry) { //如果靜態資源已經被自定義了,則直接生效if (!this.resourceProperties.isAddMappings()) {logg…

基于OpenCV的人臉識別:LBPH算法

文章目錄 引言一、概述二、代碼實現1. 代碼整體結構2. 導入庫解析3. 訓練數據準備4. 標簽系統5. 待識別圖像加載6. LBPH識別器創建7. 模型訓練8. 預測執行9. 結果輸出 三、 LBPH算法原理解析四、關鍵點解析五、改進方向總結 引言 人臉識別是計算機視覺領域的一個重要應用&…

ElasticSearch重啟之后shard未分配問題的解決

以下是Elasticsearch重啟后分片未分配問題的完整解決方案,結合典型故障場景與最新實踐: 一、快速診斷定位 ?檢查集群狀態 GET /_cluster/health?pretty # status為red/yellow時需關注unassigned_shards字段值 ? 2.查看未分配分片詳情 …

CSS- 3.1 盒子模型-塊級元素、行內元素、行內塊級元素和display屬性

本系列可作為前端學習系列的筆記,代碼的運行環境是在HBuilder中,小編會將代碼復制下來,大家復制下來就可以練習了,方便大家學習。 HTML系列文章 已經收錄在前端專欄,有需要的寶寶們可以點擊前端專欄查看! 點…

Git/GitLab日常使用的命令指南來了!

在 GitLab 中拉取并合并代碼的常見流程是通過 Git 命令來完成的。以下是一個標準的 Git 工作流,適用于從遠程倉庫(如 GitLab)拉取代碼、切換分支、合并更新等操作。 🌐 一、基礎命令:拉取最新代碼 # 拉取遠程倉庫的所…

HTML 表格與div深度解析區別及常見誤區

一、HTML<div>元素詳解 <div>是HTML中最基本的塊級容器元素&#xff0c;本身沒有語義&#xff0c;主要用于組織和布局頁面內容。以下是其核心用法&#xff1a; 1. 基礎結構與特性 <div><!-內部可包含任意HTML元素 --><h2>標題</h2><p…

mybatisPlus 新增時 其他字段的值和 id 保持一致實現方法

MyBatis-Plus 實現 sp_id_path 與 id 同步的方案 要實現新增時 sp_id_path 自動與 id 保持一致&#xff0c;需要在實體類和插入邏輯中做相應處理。MyBatis-Plus 提供了幾種方式來實現這一需求&#xff1a; 方案一&#xff1a;使用 MyBatis-Plus 的自動填充功能 這是最優雅的…

蘭亭妙微設計:為生命科技賦予人性化的交互語言

在醫療科技日新月異的今天&#xff0c;卓越的硬件性能唯有匹配恰如其分的交互語言&#xff0c;方能真正發揮價值。作為專注于醫療UI/UX設計的專業團隊&#xff0c;蘭亭妙微設計&#xff08;www.lanlanwork.com&#xff09;始終相信&#xff1a;每一處像素的排布&#xff0c;都應…

Tcping詳細使用教程

Tcping詳細使用教程 下載地址 https://download.elifulkerson.com/files/tcping/0.39/在windows環境下安裝tcping 在以上的下載地中找到exe可執行文件&#xff0c;其中tcping.exe適用于32位Windows系統&#xff0c;tcping64.exe適用于64位Windows操作系統。 其實tcping是個…

springCloud/Alibaba常用中間件之Seata分布式事務

文章目錄 SpringCloud Alibaba:依賴版本補充Seata處理分布式事務(AT模式)AT模式介紹核心組件介紹AT的工作流程&#xff1a;兩階段提交&#xff08;**2PC**&#xff09; Seata-AT模式使用Seata(2.0.0)下載、配置和啟動Seata案例實戰前置代碼添加全局注解 GlobalTransactional Sp…

COMSOL隨機參數化表面流體流動模擬

基于粗糙度表面的裂隙流研究對于理解地下水的流動、污染物傳輸以及與之相關的地質災害&#xff08;如滑坡&#xff09;等方面具有重要意義。本研究通過蒙特卡洛方法生成隨機表面形貌&#xff0c;并利用COMSOL Multiphysics對隨機參數化表面的微尺度流體流動進行模擬。 參數化…