Postgres-XL使用说明文档 下载本文

# userdel -r postgres

7. 配置无密码登录

既需要配置postgres用户,还需要配置root用户。 ------- root 用户 ----------------------------------------- --- scada_server1节点

[root @scada_server1 ~]# ssh-keygen

[root @scada_server1 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server1 [root @scada_server1~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server2 [root @scada_server1~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server3

--- scada_server2节点

[root @scada_server2~]# ssh-keygen

[root @scada_server2~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server2 [root @scada_server2~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server1 [root @scada_server2~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server3

--- scada_server3节点

[root @scada_server3~]# ssh-keygen

[root @scada_server3~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server3 [root @scada_server3~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server1 [root @scada_server3~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@scada_server2

-------- 用户 postgres ------------------------------------ --- scada_server1节点

[postgres @scada_server1~]$ ssh-keygen

[postgres @scada_server1~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server1 [postgres @scada_server1~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server2 [postgres @scada_server1~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server3

--- scada_server2节点

[postgres @scada_server2~]$ ssh-keygen

[postgres @scada_server2~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server2 [postgres @scada_server2~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server1 [postgres @scada_server2~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server3

--- scada_server3节点

[postgres @scada_server3~]$ ssh-keygen

[postgres @scada_server3~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server3 [postgres @scada_server3~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server1 [postgres @scada_server3~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub postgres@scada_server2

8. 修改内核参数

执行:

# vi /etc/sysctl.conf

添加以下参数

kernel.sem = 50100 128256000 50100 2560 执行: # sysctl -p 使参数生效 执行: # ipcs -ls

验证参数是否生效。

------ Semaphore Limits -------- max number of arrays = 2560

max semaphores per array = 50100

max semaphores system wide = 128256000 max ops per semop call = 50100 semaphore max value = 32767

9. 配置防火墙

9.1 关闭防火墙(以root用户执行)

# service iptables stop

# chkconfig iptables off --重启后生效

9.2 在防火墙中开放端口

具体需要开放的端口参加(主机规划部分),以5302为例: 使用这些命令来永久打开一个新端口(如TCP/5302)。

# sudo firewall-cmd --zone=public --add-port=5302/tcp --permanent # sudo firewall-cmd --reload

注:需要保证防火墙是开启的才能执行。

注:查看防火墙状态命令:systemctl status firewalld 注:开启防火墙:systemctl start firewalld 注:关闭防火墙:systemctl stop firewalld

10. 关闭SELinux

查看SELinux状态,执行: # /usr/sbin/sestatus -v

##如果SELinux status参数为enabled即为开启状态 永久关闭,执行:

# vi /etc/selinux/config --重启后生效

将 SELINUX=enforcing 改为 SELINUX=disabled

11. 安装Postgres-XL软件

11.1 执行postgrex-xl软件安装

-- scada_server1节点--

[root @scada_server1~]# cd /mytmp

[root @scada_server1mytmp]# tar -jxvfpostgres-xl-9.5r1.6.tar.bz2

[root @scada_server1mytmp]# chown -R postgres:postgres postgres-xl-9.5r1.6 [root @scada_server1mytmp]# su - postgres

[postgres @scada_server1~]$ cd /mytmp/postgres-xl-9.5r1.6

[postgres @scada_server1 postgres-xl-9.5r1.6]$ ./configure --prefix=/home/postgres/pgxl9.5 [postgres @scada_server1 postgres-xl-9.5r1.6]$ make

[postgres @scada_server1 postgres-xl-9.5r1.6]$ make install --安装拓展--

[postgres @scada_server1 postgres-xl-9.5r1.6]$ cd contrib [postgres @scada_server1 contrib]$ make

[postgres @scada_server1 contrib]$ make install

-- scada_server2节点--

[root @scada_server2~]# cd /mytmp

[root @scada_server2 mytmp]# tar -jxvfpostgres-xl-9.5r1.6.tar.bz2

[root @scada_server2 mytmp]# chown -R postgres:postgres postgres-xl-9.5r1.6 [root @scada_server2 mytmp]# su - postgres

[postgres @scada_server2 ~]$ cd /mytmp/postgres-xl-9.5r1.6

[postgres @scada_server2 postgres-xl-9.5r1.6]$ ./configure --prefix=/home/postgres/pgxl9.5 [postgres @scada_server2 postgres-xl-9.5r1.6]$ make

[postgres @scada_server2 postgres-xl-9.5r1.6]$ make install --安装拓展--

[postgres @scada_server2 postgres-xl-9.5r1.6]$ cd contrib [postgres @scada_server2 contrib]$ make

[postgres @scada_server2 contrib]$ make install

-- scada_server3节点--

[root @scada_server3 ~]# cd /mytmp

[root @scada_server3 mytmp]# tar -jxvfpostgres-xl-9.5r1.6.tar.bz2

[root @scada_server3 mytmp]# chown -R postgres:postgres postgres-xl-9.5r1.6 [root @scada_server3 mytmp]# su - postgres

[postgres @scada_server3 ~]$ cd /mytmp/postgres-xl-9.5r1.6

[postgres @scada_server3 postgres-xl-9.5r1.6]$ ./configure --prefix=/home/postgres/pgxl9.5 [postgres @scada_server3 postgres-xl-9.5r1.6]$ make

[postgres @scada_server3 postgres-xl-9.5r1.6]$ make install --安装拓展--

[postgres @scada_server3 postgres-xl-9.5r1.6]$ cd contrib [postgres @scada_server3 contrib]$ make

[postgres @scada_server3 contrib]$ make install

11.2 配置环境变量

修改三个服务器节点的环境变量,执行以下操作: # su - postgres # vi .bashrc

添加如下内容:

export PGHOME=/home/postgres/pgxl9.5 export PGUSER=postgres

export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH export PATH=$PGHOME/bin:$PATH

效果如下图所示:

使环境变量生效: # source ~/.bashrc

验证环境变量是否生效: pg_ctl --version 输出:

pg_ctl (PostgreSQL) 9.5.8 (Postgres-XL 9.5r1.6)

11.3 创建 gtm、coordinator、datanode 相关目录

-- scada_server1节点--

[postgres @scada_server1 ~]$ cd $PGHOME [postgres @scada_server1 pgxl9.5]$ mkdir data