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.mzph.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对随机参数化表面的微尺度流体流动进行模拟。 参数化…