diff --git a/content/chinese/news/news-post-22.md b/content/chinese/news/news-post-22.md index f68fbd5..180da5c 100644 --- a/content/chinese/news/news-post-22.md +++ b/content/chinese/news/news-post-22.md @@ -192,45 +192,249 @@ systemctl stop firewalld 互信为了方便后续操作,建议配置opentenbase机器间的 SSH 互信: -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c1e31d58-9694-11ef-a88b-fa163eb4f6be.png) +``` +[opentenbase] +#切换opentenbase用户 +su - opentenbase + +# 192.168.2.136生成 SSH 密钥对 +ssh-keygen -t rsa + +# 将公钥复制到其他节点 +ssh-copy-id -i ~/.ssh/id_rsa.pub opentenbase@192.168.2.136 +ssh-copy-id -i ~/.ssh/id_rsa.pub opentenbase@192.168.2.137 +ssh-copy-id -i ~/.ssh/id_rsa.pub opentenbase@192.168.2.138 +``` **6.3 配置opentenbase环境变量** 集群所有机器都需要配置 -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c1ef391c-9694-11ef-a88b-fa163eb4f6be.png) +``` +[opentenbase] +$ vim ~/.bashrc +export OPENTENBASE_HOME=/data/opentenbase/install/opentenbase_bin_v2.6 +export PATH=$OPENTENBASE_HOME/bin:OPENTENBASEHOME/bin:$PATH +export LD_LIBRARY_PATH=$OPENTENBASE_HOME/lib:OPENTENBASEHOME/lib:${LD_LIBRARY_PATH} +export LC_ALL=C +``` **6.4 配置root环境变量** 集群所有机器都需要配置,把opentenbase用户的$PATH环境变量添加到 etc/environment -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c20293fe-9694-11ef-a88b-fa163eb4f6be.png) +``` +[root] +cat /etc/environment +PATH=/data/opentenbase/install/opentenbase_bin_v2.6/bin:/data/opentenbase/.local/bin:/data/opentenbase/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin +``` **6.5 初始化pgxc\_ctl.conf文件** -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c20d75d0-9694-11ef-a88b-fa163eb4f6be.png) +``` +[opentenbase] +mkdir /data/opentenbase/pgxc_ctl +cd /data/opentenbase/pgxc_ctl +vim pgxc_ctl.conf +``` 如下,是结合上文描述的IP,端口,数据库目录,二进制目录等规划来写的pgxc\_ctl.conf文件。 pgxc\_ctl.conf配置如下: -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c21e4838-9694-11ef-a88b-fa163eb4f6be.png) - -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c22a4034-9694-11ef-a88b-fa163eb4f6be.png) - -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c245cafc-9694-11ef-a88b-fa163eb4f6be.png) - -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c258875a-9694-11ef-a88b-fa163eb4f6be.png) - -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c2680ae0-9694-11ef-a88b-fa163eb4f6be.png) - -![](https://oss-emcsprod-public.modb.pro/image/auto/modb_20241030_c27ffb46-9694-11ef-a88b-fa163eb4f6be.png) +``` +#!/bin/bash +# Double Node Config + +#主要调整IP地址即可 +IP_1=192.168.2.136 +IP_2=192.168.2.137 + +pgxcInstallDir=/data/opentenbase/install/opentenbase_bin_v2.6 +pgxcOwner=opentenbase +defaultDatabase=postgres +pgxcUser=$pgxcOwner +tmpDir=/tmp +localTmpDir=$tmpDir +configBackup=n +configBackupHost=pgxc-linker +configBackupDir=$HOME/pgxc +configBackupFile=pgxc_ctl.bak + + +#---- GTM ---------- +gtmName=gtm +gtmMasterServer=$IP_1 +gtmMasterPort=50001 +gtmMasterDir=/data/opentenbase/data/gtm +gtmExtraConfig=none +gtmMasterSpecificExtraConfig=none +gtmSlave=y +gtmSlaveServer=$IP_2 +gtmSlavePort=50001 +gtmSlaveDir=/data/opentenbase/data/gtm +gtmSlaveSpecificExtraConfig=none + +#---- Coordinators ------- +coordMasterDir=/data/opentenbase/data/coord +coordArchLogDir=/data/opentenbase/data/coord_archlog + +coordNames=(cn001 cn002 ) +coordPorts=(30004 30004 ) +poolerPorts=(31110 31110 ) +coordPgHbaEntries=(0.0.0.0/0) +coordMasterServers=($IP_1 IP1$IP_2) +coordMasterDirs=($coordMasterDir coordMasterDir$coordMasterDir) +coordMaxWALsernder=2 +coordMaxWALSenders=($coordMaxWALsernder coordMaxWALsernder$coordMaxWALsernder ) +coordSlave=n +coordSlaveSync=n +coordArchLogDirs=($coordArchLogDir coordArchLogDir$coordArchLogDir) + +coordExtraConfig=coordExtraConfig +cat > $coordExtraConfig $coordExtraPgHba < $datanodeExtraConfig < $datanodeExtraPgHba <