第一次接触分布式的数据库,对于各种配置都不是很熟悉,经过网上各种查资料,显示仔细阅读,了解原理,终于功夫不负有心人,经历一次失败后,让我配置成功了!因此做了总结以便以后查看,也用来和大家交流经验。
下面我就详细说一下安装步骤:
系统:centos 6.8
服务器:四台,每台2个CPU,每个CPU是4核
192.168.0.101 master
192.168.0.102 seg1
192.168.0.103 seg2
192.168.0.104 seg3
四台服务器都做存储,每台上起四个primary,并且有四个mirror。
[root@master ~]# vi /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
#
# Use '/sbin/sysctl -a' to list all possible parameters.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
kernel.msgmni = 2048
kernel.sem = 250 512000 100 2048
# Controls the maximum shared segment size, in bytes
#kernel.shmmax = 68719476736
kernel.shmmax = 500000000
kernel.shmmni = 4096
# Controls the maximum number of shared memory segments, in pages
#kernel.shmall = 4294967296
kernel.shmall = 4000000000
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
net.ipv4.conf.all.arp_filter = 1
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
[root@master ~]# vi /etc/hosts
添加如下:
192.168.0.101 master
192.168.0.102 seg1
192.168.0.103 seg2
192.168.0.104 seg3
设置名字和上面配置名字要统一
#useradd gpadmin
#passwd gpadmin
#reboot
[gpadmin@bj-gp-node1 ~]$ cd /home/gpadmin
[gpadmin@bj-gp-node1 ~]$ vi .bashrc
[gpadmin@bj-gp-node1 ~]$ vi .bash_profile
.bashrc和.bash_profile最后都添加下面两行
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data1/gpdata/master/gpseg-1
注意:加红的是master的数据目录,要与你下面创建的数据目录一致
mkdir -p /opt/gpinit/all_host
mkdir -p /opt/gpinit/all_segment
需要几个节点就要创建多少个文件
像我安装的系统我创建了四个primary文件和四个mirror,因为是master所以还有一个master文件
本步主要是将master上的安装后的文件拷贝到其他segment服务器上,看自己喜好,可以用gpssh也可以分别操作。
[gpadmin@master gpconfigs]$ vi gpinitsystem_config
# FILE NAME: gpinitsystem_config
# Configuration file needed by the gpinitsystem
################################################
#### REQUIRED PARAMETERS
################################################
#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="BJ Greenplum DW"
#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg
#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=40000
#### File system location(s) where primary segment data directories
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per
#### physical host (if multiple addresses for a host are listed in
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
这属性目的:设置节点上实例对应的数据存储目录,与上面创建的目录要对应。只添加primary的。
declare -a DATA_DIRECTORY=(/data1/gpdata/primary /data1/gpdata/primary)
#### OS-configured hostname or IP address of the master host.
这个属性设置主机的名字
MASTER_HOSTNAME=master
#### File system location where the master data directory
#### will be created.
设置master的目录
MASTER_DIRECTORY=/gpdata/master
#### Port number for the master instance.
MASTER_PORT=5432
#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh
#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8
#### Default server-side character set encoding.
ENCODING=UNICODE
下面的属性是用来设置mirror的配置
################################################
#### OPTIONAL MIRROR PARAMETERS
################################################
#### Base number by which mirror segment port numbers
#### are calculated.
MIRROR_PORT_BASE=50000
#### Base number by which primary file replication port
#### numbers are calculated.
REPLICATION_PORT_BASE=41000
#### Base number by which mirror file replication port
#### numbers are calculated.
MIRROR_REPLICATION_PORT_BASE=51000
#### File system location(s) where mirror segment data directories
#### will be created. The number of mirror locations must equal the
#### number of primary locations as specified in the
#### DATA_DIRECTORY parameter.
这个属性和上面一样的作用;设置mirror的目录,要与上面创建的一致
declare -a MIRROR_DATA_DIRECTORY=(/data1/gpdata/mirror /data1/gpdata/mirror)
################################################
#### OTHER OPTIONAL PARAMETERS
################################################
#### Create a database of this name after initialization.
初始化的后创建的数据库的名字
DATABASE_NAME=gp_db_my
#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem
1、gpstart
不报错就说明安装成功了。
2、gpstate -c/-m
可以查看各个实例的状态。