一、增加主机名
groupadd -g 3030 gpadmin
useradd -u 3030 gpadmin -g gpadmin -d /home/gpadmin
echo gpadmin |passwd gpadmin --stdin
二、配置域名解析,这里是单机测试环境,我选择使用hosts来解析
vim /etc/hosts
192.168.12.248 greenplum03
多机ping相通
三、配置内核参数,添加如下内容
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sem = 250 64000 100 512
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 64000 100 512
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
net.ipv4.conf.all.arp_filter = 1
sysctl -p
配置文件访问
在limits.conf文件中添加如下配置:
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
四、配置磁盘参数
设置磁盘预读,优化磁盘IO效率(重启系统才能生效)
vi /boot/grub/menu.lst
elevator=deadline
vi /etc/rc.d/rc.local
blockdev --setra 16384 /dev/sd*
验证内核参数配置是否生效:
[root@goolen ~]# cat /sys/block/*/queue/scheduler
noop anticipatory deadline [cfq]
noop anticipatory deadline [cfq]
输出的行应该含有[deadline]
五、配置用户ssh无密码登陆,单机环境也得配置(gpadmin用户)
ssh-keygen -t rsa
ssh-keygen -t dsa
cd .ssh/
cat *.pub------------------------将文件内容复制authorized_keys中
vi authorized_keys
chmod 644 authorized_keys
ssh greenplum03 date---------------------测试验证无密码登录
六、安装GP软件:
a、许可
Do you accept the Pivotal Database license agreement? [yes|no]
b、选择安装木库
Provide the installation path for Greenplum Database or press ENTER to
accept the default installation path: /usr/local/greenplum-db-5.0.0
Install Greenplum Database into /usr/local/greenplum-db-5.0.0? [yes|no]
c、安装
/usr/local/greenplum-db-5.0.0 does not exist.
Create /usr/local/greenplum-db-5.0.0 ? [yes|no]
(Selecting no will exit the installer)
Extracting product to /usr/local/greenplum-db-5.0.0
七、初始化系统:
a、创建instance需要的目录:
mkdir -p /tol/master
mkdir -p /tol/data/gp1
mkdir -p /tol/data/gp2
b、修改权限
chown -R gpadmin:gpadmin /usr/local/green*
chown -R gpadmin:gpadmin /tol/master
chown -R gpadmin:gpadmin /tol/data/gp*
c、配置环境变量
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1------------完成后注意修改为主节点目录
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=goolen------主机名
d、在home下创建文件
编辑all_hosts_file文件,添加如下内容:
vim all_hosts_file--------------------master和segment机器名
greenplum03
vim seg_hosts_file--------------segment机器名
greenplum03
3,初始化系统
编辑系统初始化的参数文件,这个文件的编辑可以使用模版,模板文件所在目录如下:
cd /usr/local/greenplum-db/docs/cli_help/gpconfigs/
cp gpinitsystem_config /home/gpadmin/
declare -a DATA_DIRECTORY=(/tol/data/gp1 /tol/data/gp2 /tol/data/gp3 /tol/data/gp4)
MASTER_HOSTNAME=greenplum03
MASTER_DIRECTORY=/tol/master
DATABASE_NAME=goolen
MACHINE_LIST_FILE=/home/gpadmin/seg_hosts_file
gpinitsystem -c gpinitsystem_config -h seg_hosts_file
gpexmp=# select current_timestamp;
now
-------------------------------
2018-03-13 06:52:40.167828+08
[gpadmin@greenplum03 ~]$ gpstop
20180313:06:54:41:015206 gpstop:greenplum03:gpadmin-[CRITICAL]:-gpstop failed. (Reason='[Errno 2]
No such file or directory: '/data/master/gpseg-1/postgresql.conf'') exiting...
创建表空间:
gpfilespace --config /home/gpadmin/gpfilespace_config_
su - gadmin
psql -d gpexmp
create TABLESPACE sqlaudit FILESPACE sqlaudit;
创建角色:
CREATE ROLE sqlaudit LOGIN ENCRYPTED PASSWORD 'sqlaudit' nosuperuser noinherit nocreatedb nocreaterole ;
创建数据库:
CREATE DATABASE sqlaudit WITH OWNER = sqlaudit TEMPLATE = template0 ENCODING = 'UTF8' TABLESPACE = sqladuit;
远程配置:
/data/sqlaudit/greenplum/master/gpseg-1/pg_hba.conf增加:
host all gpadmin 192.168.128.128/32 trust
greenplumn----------单机2segment安装
原文:http://blog.51cto.com/11310506/2085823