greenplum数据库的安装
一、服务器准备
1、关闭防火墙
service iptables stop
chkconfig iptables off
2、关闭selinux
vi /etc/selinux/config
SELINUX=disabled
3、修改内核参数
vi /etc/sysctl.conf
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
4、配置文件参数
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
For RedHat Enterprise Linux 6.x and CentOS 6.x, parameter values in the /etc/security/limits.d/90-nproc.conf file override the values in the limits.conf file. If a parameter value is set in both conf files, ensure that the parameter is set properly in the 90-nproc.conf file.(如果你的操作系统是红帽6或者CNETOS6系列的话,将这些文件参数配置于 /etc/security/limits.d/90-nproc.conf 文件中)
5、磁盘分区建议使用XFS文件管理系统
XFS is the preferred file system on Linux platforms for data storage. Greenplum recommends the following XFS mount options:
rw,noatime,inode64,allocsize=16m
See the manual page (man) for the mount command for more information about using that command(man mount opens the man page).The XFS options can also be set in the /etc/fstab file. This example entry from an fstab file specifies the XFS options.
/dev/data /data xfs nodev,noatime,inode64,allocsize=16m 0 0
6、调整IO调度算法,建议使用 deadline
The Linux disk I/O scheduler for disk access supports different policies, such as CFQ, AS, and deadline.Pivotal recommends the following scheduler option: deadline.Add the parameter elevator=deadline to the kernel command in the file /boot/grub/grub.conf, the GRUB boot loader configuration file.(cat /sys/block/devname/queue/scheduler)
kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=LABEL=/ elevator=deadline crashkernel=128M@16M quiet console=tty1
console=ttyS1,115200 panic=30 transparent_hugepage=never initrd /initrd-2.6.18-274.3.1.el5.img
7、配置磁盘预读,根据自己实际情况进行配置
Each disk device file should have a read-ahead (blockdev) value of 16384.
blockdev --getra /dev/sdb(devname)
blockdev --setra 16384(bytes) /dev/sdb(devname)
8、配置hosts文件,把即将安装的所有节点名添加进来
vi /etc/hosts
mdw
mdw-1
mdw-2
smdw
smdw-1
smdw-2
sdw1
sdw1-1
sdw1-2
…
9、关闭内存大页
Disable Transparent Huge Pages (THP). RedHat Enterprise Linux 6.0 or higher enables THP by default. THP degrades Greenplum Database performance.One way to disable THP is by adding the parameter transparent_hugepage=never to the kernel command in the file /boot/grub/grub.conf(cat /sys/kernel/mm/redhat_transparent_hugepage/enabled)
二、先在master节点上传数据库安装包并进行安装
unzip greenplum-db-4.3**.zip
/bin/bash greenplum-db-4.3.**.bin
三、配置path
source /usr/local/greenplum-db/greenplum_path.sh
四、所有节点建立root互信,完成这一步即可使用 gpssh 工具方便地操作所有节点
vi /all_hosts
#添加所有的节点名
gpssh-exkeys -f /all_hosts
五、 创建 gpadmin 用户:
gpssh -f /all_hosts
groupadd gpadmin
useradd -g gpadmin gpadmin
echo "gpadmin" | passwd gpadmin --stdin
六、建立所有计算节点 gpadmin 互信:
vi /all_segs
su - gpadmin
vi .bash_profile
source /usr/..
gpssh-exkeys -f /all_hosts
七、设置时间同步:
gpssh -f /all_segs -v date
vi /etc/ntp.conf
restrict 127.0.0.1
restrict -6 ::1
server 192.168.2.141
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
八、创建数据库的数据文件夹
mkdir -p /data/master
chown -R gpadmin:gpadmin /data/master
[ gpssh -h ]
gpssh -f /all_segs
mkdir -p /data1/primary /data1/mirror /data2/primary /data2/mirror
chown -R gpadmin:gpadmin /data1/primary /data1/mirror /data2/primary /data2/mirror
九、给计算节点安装数据库:
tar -cvf /home/gpadmin/gp.tar /usr/local/..*
gpscp -f /all_segs /home/gpadmin/gp.tar =:/usr/local/
gpssh -f /all_segs
gtar --directory /usr/local -xvf /usr/local/gp.tar
ln -s /usr/local/..* /usr/local/..
chown -R gpadmin:gpadmin /usr/local/..
十、初始化数据库:
cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpinitsystem_config
vi /home/gpadmin/gpinitsystem_config
gpinitsystem -c gpinitsystem_config -h /all_segs [ -s msdw -S ]
十一、配置directory
vi .bash_profile
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1