1、修改/etc/hosts文件
注:使用root用户操作
将需要修改***主机名、ip地址***对应关系写入/etc/hosts文件。
[omm@host1 dn1]$ cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.13.107 host1 ::1 localhost #Gauss OM IP Hosts Mapping
2、修改ip地址
2.1 查看当前配置
注:使用omm用户操作。
[omm@host1 ~]$ cd $PGDATA [omm@host1 dn1]$ cat postgresql.conf|grep "101" listen_addresses = 'localhost,192.168.13.101' # what IP address(es) to listen on; local_bind_address = '192.168.13.101'

[omm@host1 dn1]$ gs_guc check -N all -I all -c "listen_addresses" The gs_guc run with the following arguments: [gs_guc -N all -I all -c listen_addresses check ]. Total GUC values: 1. Failed GUC values: 0. The value of parameter listen_addresses is same on all instances. listen_addresses='localhost,192.168.13.101' [omm@host1 dn1]$ gs_guc check -N all -D $PGDATA -c "listen_addresses" The gs_guc run with the following arguments: [gs_guc -N all -D /opt/openGauss/install/data/dn1 -c listen_addresses check ]. Total GUC values: 1. Failed GUC values: 0. The value of parameter listen_addresses is same on all instances. listen_addresses='localhost,192.168.13.101'
2.2 修改postgresql.conf
注:使用omm用户操作。
修改参数可以使用两种方法:
方法1:
通过gs_guc命令进行修改。方便快捷。
[omm@host1 dn1]$ gs_guc set -N all -D $PGDATA -c "listen_addresses='localhost,192.168.13.107'" The gs_guc run with the following arguments: [gs_guc -N all -D /opt/openGauss/install/data/dn1 -c listen_addresses='localhost,192.168.13.107' set ]. Begin to perform the total nodes: 1. Popen count is 1, Popen success count is 1, Popen failure count is 0. Begin to perform gs_guc for datanodes. Command count is 1, Command success count is 1, Command failure count is 0. Total instances: 1. Failed instances: 0. ALL: Success to perform gs_guc! [omm@host1 dn1]$ gs_guc set -N all -D $PGDATA -c "local_bind_address='192.168.13.107'" The gs_guc run with the following arguments: [gs_guc -N all -D /opt/openGauss/install/data/dn1 -c local_bind_address='192.168.13.107' set ]. Begin to perform the total nodes: 1. Popen count is 1, Popen success count is 1, Popen failure count is 0. Begin to perform gs_guc for datanodes. Command count is 1, Command success count is 1, Command failure count is 0. Total instances: 1. Failed instances: 0. ALL: Success to perform gs_guc!
方法2:
通过编辑配置文件进行修改:
需要注意的是,如果是多实例需要修改多个参数文件。
[omm@host1 ~]$ cd $PGDATA [omm@host1 dn1]$ vi postgresql.conf

3 修改pg_hba.conf文件
注:使用omm用户操作。
[omm@host1 dn1]$ cd $PGDATA [omm@host1 dn1]$ vi pg_hba.conf

4 修改cluster.xml
注:使用omm用户操作。
*需要先在当前环境生成xml文件*
[omm@host1 script]$ gs_om -t generate_xml Start generate xml. Successfully generated xml. the xml is /home/omm/xml_output_20241231233720.xml [omm@host1 script]$ cd [omm@host1 ~]$ ls cluster.xml gaussdb_tmp gauss_om tmp_generate_xml wdr_sarah.html xml_output_20241231233720.xml [omm@host1 ~]$ cat xml_output_20241231233720.xml <?xml version="1.0" encoding="UTF-8"?> <ROOT> <CLUSTER> <PARAM name="clusterName" value="Cluster_template"/> <PARAM name="nodeNames" value="host1"/> <PARAM name="gaussdbAppPath" value="/opt/openGauss/install/app"/> <PARAM name="gaussdbLogPath" value="/opt/openGauss/install/log"/> <PARAM name="tmpMppdbPath" value="/opt/openGauss/install/tmp"/> <PARAM name="gaussdbToolPath" value="/opt/openGauss/install/tool"/> <PARAM name="corePath" value="/opt/openGauss/install/corefile"/> <PARAM name="backIp1s" value="192.168.13.107"/> </CLUSTER> <DEVICELIST> <DEVICE sn="host1"> <PARAM name="name" value="host1"/> <PARAM name="azName" value="AZ1"/> <PARAM name="azPriority" value="1"/> <PARAM name="backIp1" value="192.168.13.107"/> <PARAM name="sshIp1" value="192.168.13.107"/> <PARAM name="dataNum" value="1"/> <PARAM name="dataPortBase" value="15000"/> <PARAM name="dataNode1" value="/opt/openGauss/install/data/dn1"/> <PARAM name="dataNode1_syncNum" value="0"/> </DEVICE> </DEVICELIST> </ROOT>
*然后修改xml文件中的ip地址信息,修改完后重新分发到各个节点。*
[omm@host1 ~]$ gs_om -t generateconf -X ./cluster.xml --distribute Generating static configuration files for all nodes. Creating temp directory to store static configuration files. Successfully created the temp directory. Generating static configuration files. Successfully generated static configuration files. Static configuration files for all nodes are saved in /opt/openGauss/install/tool/script/static_config_files. Distributing static configuration files to all nodes. Successfully distributed static configuration files.
5 启动数据库
[omm@host1 dn1]$ gs_om -t start Starting cluster. ========================================= [SUCCESS] host1 2024-12-31 23:18:34.410 67740b4a.1 [unknown] 140406870100672 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets 2024-12-31 23:18:34.410 67740b4a.1 [unknown] 140406870100672 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: could not create any HA TCP/IP sockets 2024-12-31 23:18:34.414 67740b4a.1 [unknown] 140406870100672 [unknown] 0 dn_6001 01000 0 [BACKEND] WARNING: Failed to initialize the memory protect for g_instance.attr.attr_storage.cstore_buffers (16 Mbytes) or shared memory (865 Mbytes) is larger. ========================================= Successfully started. [omm@host1 static_config_files]$ gs_om -t status --detail [ Cluster State ] cluster_state : Normal redistributing : No current_az : AZ_ALL [ Datanode State ] node node_ip port instance state \------------------------------------------------------------------------------------------------ 1 host1 192.168.13.107 15000 6001 /opt/openGauss/install/data/dn1 P Primary Normal
附录1 gs_guc命令介绍
[omm@host1 dn1]$ gs_guc -? gs_guc is an inferface to modify config files or encrypt plain text to cipher text. Checking GUC parameters: gs_guc check [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} {-c "parameter", -c "parameter", ...} gs_guc check [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} {-c parameter, -c parameter, ...} Configuring GUC parameters: Usage: gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--lcname=LCNAME] [--ignore-node=NODES] {-c "parameter = value" -c "parameter = value" ...} gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--lcname=LCNAME] [--ignore-node=NODES] {-c " parameter = value " -c " parameter = value " ...} gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--lcname=LCNAME] [--ignore-node=NODES] {-c "parameter = 'value'" -c "parameter = 'value'" ...} gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--lcname=LCNAME] [--ignore-node=NODES] {-c " parameter = 'value' " -c " parameter = 'value' " ...} gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--lcname=LCNAME] [--ignore-node=NODES] {-c "parameter" -c "parameter" ...} e.g. gs_guc set -Z datanode -N all -I all -c "program = '\"Hello\", World\!'". e.g. gs_guc reload -Z datanode -N all -I all -c "program = '\"Hello\", World\!'". If parameter value set or reload to DEFAULT OR COMMENT configuration parameter, use the form: -c "parameter" You can choose Usage as you like, and perhaps the first one will be more suitable for you! Configuring Authentication Policy: gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME IPADDR IPMASK AUTHMEHOD authentication-options" gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME IPADDR-WITH-IPMASK AUTHMEHOD authentication-options" gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME HOSTNAME AUTHMEHOD authentication-options" If authentication policy need to set/reload DEFAULT OR COMMENT then provide without authentication menthod, use the form: gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME IPADDR IPMASK" gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME IPADDR-WITH-IPMASK " gs_guc {set | reload} [-Z NODE-TYPE] [-N NODE-NAME] {-I INSTANCE-NAME | -D DATADIR} [--ignore-node=NODES] -h "HOSTTYPE DATABASE USERNAME HOSTNAME" Encrypt plain text to cipher text: gs_guc encrypt [-M keymode] -K password [-U username] {-D DATADIR | -R RANDFILEDIR -C CIPHERFILEDIR} Generate plain cipher key to cipher text: gs_guc generate [-o prefix] -S cipherkey -D DATADIR Common options: -N nodename in which this command need to be executed -I instance name -D, --pgdata=DATADIR location of the database storage area -c parameter=value the parameter to set -c parameter the parameter value to DEFAULT (i.e comments in configuration file) --lcname=LCNAME logical cluter name. It only can be used with datanode --ignore-node=NODES Nodes which need to ignore. It only can be used with set/reload operation,and CN/DN nodetype -h host-auth-policy to set authentication policy in HBA conf file -?, --help show this help, then exit -V, --version output version information, then exit Options for set with -c parameter: -Z NODE-TYPE can be "datanode", "cmserver" or "cmagent". NODE-TYPE is used to identify configuration file (with -c parameter) in data directory "datanode" -- postgresql.conf "cmserver" -- cm_server.conf "cmagent" -- cm_agent.conf Options for set and reload with -h host-auth-policy: -Z NODE-TYPE can only be "datanode" Options for encrypt: -M, --keymode=MODE the cipher files will be applies in server, client or source,default value is server mode -K PASSWORD the plain password you want to encrypt, which length should between 8~15 and at least 3 different types of characters -U, --keyuser=USER if appointed, the cipher files will name with the user name -R RANDFILEDIR set the dir that put the rand file -C CIPHERFILEDIR set the dir that put the cipher file Options for generate: -o PREFIX the cipher files prefix. default value is obsserver -S CIPHERKEY the plain password you want to encrypt, which length should between 8~15 and at least 3 different types of characters
最后修改时间:2025-01-01 00:09:16
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




