From b9853b83a5266bd14057f4be227d91b0c575783d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A6=E8=88=8D?= <11792506+chenchaofeng001@user.noreply.gitee.com> Date: Tue, 18 Oct 2022 08:31:20 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20wuku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/zh/post/wuku/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 content/zh/post/wuku/.keep diff --git a/content/zh/post/wuku/.keep b/content/zh/post/wuku/.keep new file mode 100644 index 00000000..e69de29b -- Gitee From a55255e344c8d919e4eac38226a48941af43b595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A6=E8=88=8D?= Date: Tue, 18 Oct 2022 08:38:06 +0000 Subject: [PATCH 2/4] =?UTF-8?q?add=20content/zh/post/wuku/2022-10-18-openG?= =?UTF-8?q?auss=203.0=E4=B8=80=E4=B8=BB=E4=B8=A4=E5=A4=87=E5=AE=89?= =?UTF-8?q?=E8=A3=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 並舍 --- ...0\244\345\244\207\345\256\211\350\243\205" | 772 ++++++++++++++++++ 1 file changed, 772 insertions(+) create mode 100644 "content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" diff --git "a/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" "b/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" new file mode 100644 index 00000000..73cc64a4 --- /dev/null +++ "b/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" @@ -0,0 +1,772 @@ +前期规划: + +环境:麒麟V10系统 + openGauss 3.0 + + IP 主机名 +主 192.168.6.201 ccf10 +备1 192.168.6.202 ccf11 +备2 192.168.6.203 ccf12 + + +目录名称 所属用户 目录路径 权限 +数据库软件目录 omm /opt/openGauss 755 +数据库数据目录 omm /data/openGauss 700 +数据库备份目录 omm /data/backup 700 +数据库归档目录 omm /data/archive_wals 700 +数据库core_dump目录 omm /data/core_pattern 700 + +1.查看系统环境 + +[root@ccf10 ~]# lscpu +架构: x86_64 +... +型号名称: Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz + +[root@ccf10 ~]# +[root@ccf10 ~]# cat /etc/os-release +NAME="Kylin Linux Advanced Server" +VERSION="V10 (Sword)" +ID="kylin" +VERSION_ID="V10" +PRETTY_NAME="Kylin Linux Advanced Server V10 (Sword)" +ANSI_COLOR="0;31" +2.安装前环境配置 +2.1主机名和hosts配置 + +[root@ccf10 ~]# hostnamectl set-hostname ccf10 +--hostnamectl set-hostname ccf11 +--hostnamectl set-hostname ccf12 + +cat >> /etc/hosts <> /etc/systemd/logind.conf +[root@ccf10 ~]# echo "RemoveIPC=no">> /usr/lib/systemd/system/systemd-logind.service +[root@ccf10 ~]# systemctl daemon-reload +[root@ccf10 ~]# systemctl stop systemd-logind +[root@ccf10 ~]# systemctl start systemd-logind +2.6内核参数调整/etc/sysctl.conf添加以下内容 + +[root@ccf10 ~]# cat >> /etc/sysctl.conf <> /etc/security/limits.conf < /proc/sys/kernel/core_pattern +2.11配置yum源并安装依赖包 + +umount /dev/sr0 +mount /dev/sr0 /mnt + +[root@ccf10 yum.repos.d]# vi /etc/yum.repos.d/kylin_x86_64.repo +###Kylin Linux Advanced Server 10 - os repo### +[local] +name=Kylin Linux Advanced Server 10 +baseurl=file:///mnt +enabled=1 +gpgcheck=0 +gpgkey=file:///mnt/RPM-GPG-KEY-kylin + + +yum repolist +yum install -y zlib-devel libaio libuuid readline-devel krb5-libs libicu libxslt tcl perl openldap pam openssl-devel libxml2 python3 +2.12修改默认python版本 + +[root@ccf10 script]# python -V +Python 2.7.18 +[root@ccf10 script]# which python +/usr/bin/python +[root@ccf10 script]# mv /usr/bin/python /usr/bin/pythonbak + +[root@ccf10 script]# ln -s /usr/bin/python3 +python3 python3.7m python3-chardetect +python3.7 python3.7m-config python3-config +python3.7-config python3.7m-x86_64-config +[root@ccf10 script]# ln -s /usr/bin/python3 /usr/bin/python +[root@ccf10 script]# +[root@ccf10 script]# python -V +Python 3.7.9 +2.13设置root用户远程登录 + +vim /etc/ssh/sshd_config + +a.修改权限配置 +•注释掉“PermitRootLogin no”。 +#PermitRootLogin no +•将“PermitRootLogin”改为“yes”。 +PermitRootLogin yes + +b.修改Banner配置 +vim /etc/ssh/sshd_config +修改Banner配置,注释掉“Banner”所在的行。 +#Banner XXXX + +systemctl restart sshd.service +2.14对于X86,MTU值推荐1500;对于ARM,MTU值推荐8192。 + +--ifconfig 网卡名称 mtu mtu值 +ifconfig ens32 mtu 8192 + +对虚拟机内存小的情况,关闭swap交换内存 +swapoff -a +3.数据库安装配置(采用cluster_config.xml安装主从) + +需配置root与omm用户ssh互信 +# 每个节点都执行 +ssh-keygen -t rsa # 一路回车 +# 将公钥添加到认证文件中 +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +# 并设置authorized_keys的访问权限 +chmod 600 ~/.ssh/authorized_keys +# 只要在一个节点执行即可。这里在 192.168.6.201上执行 +ssh 192.168.6.202 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys +ssh 192.168.6.203 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys +# 分发整合后的文件到其它节点 +scp ~/.ssh/authorized_keys 192.168.6.202:~/.ssh/ +scp ~/.ssh/authorized_keys 192.168.6.203:~/.ssh/ +3.1解压文件及配置cluster_config.xml + +[root@ccf10 ~]# cd /opt/openGauss/ +[root@ccf10 openGauss]# mv /root/openGauss-3.0.0-openEuler-64bit-all.tar.gz ./ + + +tar -zxvf openGauss-3.0.0-openEuler-64bit-all.tar.gz +tar -zxvf openGauss-3.0.0-openEuler-64bit-om.tar.gz + +[root@ccf10 openGauss]# cp script/gspylib/etc/conf/cluster_config_template.xml /home/omm/cluster_config.xml +[root@ccf10 openGauss]# vi /home/omm/cluster_config.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +3.2执行预安装脚本 + +[root@ccf10 script]# ./gs_preinstall -U omm -G dbgrp -X /home/omm/cluster_config.xml +[root@ccf10 script]# chown omm:dbgrp -R /opt/openGauss/ +3.3执行安装脚本(默认SQL_ASCII字符) + +[root@ccf10 script]# su - omm +[omm@ccf10 ~]$ cd /opt/openGauss/script/ +[omm@ccf10 script]$ ./gs_install -X /home/omm/cluster_config.xml +Parsing the configuration file. +Check preinstall on every node. +Successfully checked preinstall on every node. +Creating the backup directory. +Successfully created the backup directory. +begin deploy.. +Installing the cluster. +begin prepare Install Cluster.. +Checking the installation environment on all nodes. +begin install Cluster.. +Installing applications on all nodes. +Successfully installed APP. +begin init Instance.. +encrypt cipher and rand files for database. +Please enter password for database: +Please repeat for database: +begin to create CA cert files +The sslcert will be generated in /opt/openGauss/install/app/share/sslcert/om +Create CA files for cm beginning. +Create CA files on directory [/opt/openGauss/install/app_02c14696/share/sslcert/cm]. file list: ['cacert.pem', 'server.key', 'server.crt', 'client.key', 'client.crt', 'server.key.cipher', 'server.key.rand', 'client.key.cipher', 'client.key.rand'] +Cluster installation is completed. +Configuring. +Deleting instances from all nodes. +Successfully deleted instances from all nodes. +Checking node configuration on all nodes. +Initializing instances on all nodes. +Updating instance configuration on all nodes. +Check consistence of memCheck and coresCheck on database nodes. +Successful check consistence of memCheck and coresCheck on all nodes. +Configuring pg_hba on all nodes. +Configuration is completed. +Starting cluster. +====================================================================== +Successfully started primary instance. Wait for standby instance. +====================================================================== +. +Successfully started cluster. +====================================================================== +cluster_state : Normal +redistributing : No +node_count : 3 +Datanode State +primary : 1 +standby : 2 +secondary : 0 +cascade_standby : 0 +building : 0 +abnormal : 0 +down : 0 + +Successfully installed application. +end deploy.. +[omm@ccf10 script]$ +3.4安装完成,环境变量修改 + +[omm@ccf10 script]$ cd +[omm@ccf10 ~]$ cat >> /home/omm/.bashrc <192.168.6.203:31106 + +sender_pid : 77522 +local_role : Primary +peer_role : Standby +peer_state : Normal +state : Streaming +sender_sent_location : 0/60001E8 +sender_write_location : 0/60001E8 +sender_flush_location : 0/60001E8 +sender_replay_location : 0/60001E8 +receiver_received_location : 0/60001E8 +receiver_write_location : 0/60001E8 +receiver_flush_location : 0/60001E8 +receiver_replay_location : 0/60001E8 +sync_percent : 100% +sync_state : Quorum +sync_priority : 1 +sync_most_available : Off +channel : 192.168.6.201:15401-->192.168.6.202:34426 + +Receiver info: +No information +[omm@ccf10 ~]$ + +[omm@ccf10 ~]$ gs_om -t status --detail +[ CMServer State ] + +node node_ip instance state +------------------------------------------------------------------------- +1 ccf10 192.168.6.201 1 /opt/openGauss/install/cm/cm_server Primary +2 ccf11 192.168.6.202 2 /opt/openGauss/install/cm/cm_server Standby +3 ccf12 192.168.6.203 3 /opt/openGauss/install/cm/cm_server Standby + +[ Cluster State ] + +cluster_state : Normal +redistributing : No +balanced : Yes +current_az : AZ_ALL + +[ Datanode State ] + +node node_ip instance state +--------------------------------------------------------------- +1 ccf10 192.168.6.201 6001 /data/openGauss P Primary Normal +2 ccf11 192.168.6.202 6002 /data/openGauss S Standby Normal +3 ccf12 192.168.6.203 6003 /data/openGauss S Standby Normal +[omm@ccf10 ~]$ +3.5设置备机可读 + +备机可读特性为可选特性,需要修改配置参数并重启主备机器后才能使用。在开启备机可读之后,备机将支持读操作,并满足数据一致性要求。 +操作步骤 +1.如果主备机上的openGauss数据库实例正在运行,请先分别停止主备机上的数据库实例。 +2.分别打开主机与备机的postgresql.conf配置文件,找到并将对应参数修改为:wal_level=hot_standby;hot_standby = on。默认装完正确的 +3.参数max_standby_streaming_delay, max_prepared_transactions, max_standby_archive_delay, hot_standby_feedback可以参考开发者指南中参数说明按需进行设置。 +4.修改完成后,分别启动主备机即可。 + +[omm@ccf10 ~]$ grep -Ev '^$|^\s*#' $PGDATA/postgresql.conf #默认值 +listen_addresses = 'localhost,192.168.6.201' # what IP address(es) to listen on; +local_bind_address = '192.168.6.201' +port = 15400 # (change requires restart) +max_connections = 5000 # (change requires restart) +unix_socket_directory = '/opt/openGauss/tmp' # (change requires restart) +unix_socket_permissions = 0700 # begin with 0 to use octal notation +session_timeout = 10min # allowed duration of any unused session, 0s-86400s(1 day), 0 is disabled +ssl = on # (change requires restart) +ssl_cert_file = 'server.crt' # (change requires restart) +ssl_key_file = 'server.key' # (change requires restart) +ssl_ca_file = 'cacert.pem' # (change requires restart) +modify_initial_password = true #Whether to change the initial password of the initial user +max_process_memory = 2GB +shared_buffers = 553MB # min 128kB +bulk_write_ring_size = 2GB # for bulkload, max shared_buffers +max_prepared_transactions = 800 # zero disables the feature +work_mem = 64MB # min 64kB +maintenance_work_mem = 128MB # min 1MB +cstore_buffers = 1GB #min 16MB +wal_level = hot_standby # minimal, archive, hot_standby or logical +checkpoint_segments = 64 # in logfile segments, min 1, 16MB each +enable_incremental_checkpoint = on # enable incremental checkpoint +incremental_checkpoint_timeout = 60s # range 1s-1h +max_wal_senders = 16 # max number of walsender processes +wal_keep_segments = 16 # in logfile segments, 16MB each; 0 disables +enable_slot_log = off +max_replication_slots = 8 # max number of replication slots.i +replconninfo1 = 'localhost=192.168.6.201 localport=15401 localheartbeatport=15405 localservice=15404 remotehost=192.168.6.202 remoteport=15401 remoteheartbeatport=15405 remoteservice=15404' # replication connection information used to connect primary on standby, or standby on primary, +replconninfo2 = 'localhost=192.168.6.201 localport=15401 localheartbeatport=15405 localservice=15404 remotehost=192.168.6.203 remoteport=15401 remoteheartbeatport=15405 remoteservice=15404' # replication connection information used to connect secondary on primary or standby, +synchronous_standby_names = 'ANY 1(dn_6002,dn_6003)' # standby servers that provide sync rep +data_replicate_buffer_size = 128MB # data replication buffer size +walsender_max_send_size = 8MB # Size of walsender max send size +enable_data_replicate = off +hot_standby = on # "on" allows queries during recovery +enable_mergejoin = off +enable_nestloop = off +enable_kill_query = off # optional: [on, off], default: off +logging_collector = on # Enable capturing of stderr and csvlog +log_directory = '/var/log/omm/omm/pg_log/dn_6001' # directory where log files are written, +log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, +log_file_mode = 0600 # creation mode for log files, +log_rotation_size = 20MB # Automatic rotation of logfiles will +log_min_duration_statement = 1800000 # -1 is disabled, 0 logs all statements +log_connections = off # log connection requirement from client +log_disconnections = off # log disconnection from client +log_duration = off # log the execution time of each query +log_hostname = off # log hostname +log_line_prefix = '%m %c %d %p %a %x %n %e ' # special values: +log_timezone = 'PRC' +enable_alarm = on +connection_alarm_rate = 0.9 +alarm_report_interval = 10 +alarm_component = '/opt/huawei/snas/bin/snas_cm_cmd' +use_workload_manager = off # Enables workload manager in the system. +autovacuum = on # Enable autovacuum subprocess? default value is 'on' +datestyle = 'iso, mdy' +timezone = 'PRC' +lc_messages = 'C' # locale for system error message +lc_monetary = 'C' # locale for monetary formatting +lc_numeric = 'C' # locale for number formatting +lc_time = 'C' # locale for time formatting +default_text_search_config = 'pg_catalog.english' +lockwait_timeout = 1200s # Max of lockwait_timeout and deadlock_timeout + 1s +pgxc_node_name = 'dn_6001_6002_6003' # Coordinator or Datanode name +audit_enabled = on +audit_directory = '/var/log/omm/omm/pg_audit/dn_6001' +explain_perf_mode = pretty +job_queue_processes = 10 # Number of concurrent jobs, optional: [0..1000], default: 10. +replication_type = 1 +application_name = 'dn_6001' +recovery_max_workers = 4 +enable_global_syscache = off +enable_double_write = on +available_zone = 'AZ1' + +以下为修改内容: +sed -i 's/max_connections \= 5000/max_connections \= 8000/g' $PGDATA/postgresql.conf +sed -i 's/max_process_memory \= 2GB/max_process_memory \= 2GB/g' $PGDATA/postgresql.conf #75%MEM +sed -i 's/shared_buffers \= 553MB/shared_buffers \= 600MB/g' $PGDATA/postgresql.conf #25%MEM +sed -i 's/work_mem \= 64MB/work_mem \= 64MB/g' $PGDATA/postgresql.conf +sed -i 's/maintenance_work_mem \= 128MB/maintenance_work_mem \= 128MB/g' $PGDATA/postgresql.conf +sed -i 's/cstore_buffers \= 16MB/cstore_buffers \= 16MB/g' $PGDATA/postgresql.conf +sed -i 's/session_timeout \= 10min/session_timeout \= 0/g' $PGDATA/postgresql.conf + +cat >> $PGDATA/postgresql.conf< Date: Tue, 18 Oct 2022 08:41:18 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20cont?= =?UTF-8?q?ent/zh/post/wuku/.keep?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/zh/post/wuku/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 content/zh/post/wuku/.keep diff --git a/content/zh/post/wuku/.keep b/content/zh/post/wuku/.keep deleted file mode 100644 index e69de29b..00000000 -- Gitee From a0715e72663fb1b71b3536d001ddab634a4ca9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A6=E8=88=8D?= Date: Tue, 18 Oct 2022 08:46:20 +0000 Subject: [PATCH 4/4] =?UTF-8?q?update=20content/zh/post/wuku/2022-10-18-op?= =?UTF-8?q?enGauss=203.0=E4=B8=80=E4=B8=BB=E4=B8=A4=E5=A4=87=E5=AE=89?= =?UTF-8?q?=E8=A3=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 並舍 --- ...\273\344\270\244\345\244\207\345\256\211\350\243\205" | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git "a/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" "b/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" index 73cc64a4..34112b41 100644 --- "a/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" +++ "b/content/zh/post/wuku/2022-10-18-openGauss 3.0\344\270\200\344\270\273\344\270\244\345\244\207\345\256\211\350\243\205" @@ -1,3 +1,12 @@ ++++ +title = "openGauss 3.0一主两备安装" +date ="2022-10-18" +tags =["openGauss安装"] +archives ="2022-10" +author ="wuku" +summary ="openGauss 3.0一主两备安装" +times ="16:50" ++++ 前期规划: 环境:麒麟V10系统 + openGauss 3.0 -- Gitee