基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——操作系统配置,安装必备软件
注意未经说明,所有本文中所有操作都默认需要作为root用户进行操作。
一、安装zmodem,用于远程上传下载文件,安装gedit,方便重定向到远程windows上编辑文件(通过xlanuch)
[root@]# yum install lrzsz -y
[root@]# yum install gedit -y
二、关闭防火墙
[root@]# systemctl disable firewalld
[root@]# systemctl stop firewalld
三、关闭SELinux
在系统运行状态暂时关闭(重启后失效):
setenforce 0
编辑设置文件/etc/sysconfig/selinux,关闭SELinux(重启生效)
备注:已发现,如果不关闭,导致HUE的load-balance服务启动报权限错误!
vim /etc/sysconfig/selinux
设置SELINUX为disabled,如下所示:
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
保存退出后复制到各个节点,或者在每个节点上重复设置。
四、卸载系统中已安装的openjdk,安装oracle jdk发行版
1,查询系统中的openjdk软件包:
[root@ep-bd01 ~]# rpm -qa|grep openjdk -i java-1.7.0-openjdk-headless-1.7.0.181-2.6.14.8.el7_5.x86_64
2,根据查询到的结果,卸载openjdk,软件包名称要一致。
[root@ep-bd01 ~]# yum remove java-1.7.0-openjdk-headless-1.7.0.181-2.6.14.8.el7_5.x86_64
3,下载最新 Oracle JDK 8.181 centos,用rpm命令安装:
[root@ep-bd01 ~]# rpm -ivh jdk-8u181-linux-x64.rpm
五、设置系统运行参数:
1 ,设置swappiness
echo 10 > /proc/sys/vm/swappiness
2, 禁用 透明大页面压缩
** 运行时设置:
echo never > /sys/kernel/mm/transparent_hugepage/defrag echo never > /sys/kernel/mm/transparent_hugepage/enabled
同样添加上面2行到/etc/rc.local以便重启是运行
【注意,为使/etc/rc.local开机可以运行,必须给/etc/rc.d/rc.local添加执行权限】
chmod +x /etc/rc.d/rc.local
六、配置用户免密互访:
详细参见:基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——安装配置OPEN-SSH,设置主机节点之间免密互访
七、设置DNS,便于集群主机互访。
1,编辑主节点/etc/hosts文件,添加集群节点地址
192.168.58.11 ep-bd01 192.168.58.12 ep-bd02 192.168.58.13 ep-bd03 192.168.58.14 ep-bd04 192.168.58.15 ep-bd05
2,分发/etc/hosts文件,scp复制到其他节点或者各个主机节点单独编辑。
scp /etc/hosts ep-bd02:/etc/. scp /etc/hosts ep-bd03:/etc/. scp /etc/hosts ep-bd04:/etc/. scp /etc/hosts ep-bd05:/etc/.
八、HAWQ2.30所需系统环境设置【全部主机节点】:
1, vim /etc/sysctl.conf,编辑如下内容:
kernel.shmmax= 1000000000 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= 0 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= 200000 net.ipv4.conf.all.arp_filter= 1 net.ipv4.ip_local_port_range= 1281 65535 net.core.netdev_max_backlog= 200000
#java程序多时,设成2会导致很多服务不能去启动! #vm.overcommit_memory= 2
vm.overcommit_memory=0 fs.nr_open= 3000000 kernel.threads-max= 798720 kernel.pid_max= 798720 #increase network net.core.rmem_max=2097152 net.core.wmem_max=2097152
保存退出后,使用命令“sysctl -p” 使之生效:
sysctl -p
2,修改/etc/security/limits.conf,设置打开文件数限制:
vim /etc/security/limits.conf
编辑如下内容:
* soft nofile 2900000 * hard nofile 2900000 * soft nproc 131072 * hard nproc 131072
重新登录以使配置生效,或者使用命令临时设置一下:
ulimit -n 10240
3, 添加gpadmin用户(greeplum admin缩写),使用/opt/gpadmin作为主目录
useradd --home=/opt/gpadmin/ --no-create-home --comment "HAWQ admin" gpadmin echo gpadmin | passwd --stdin gpadmin mkdir /opt/gpadmin chown gpadmin:gpadmin /opt/gpadmin
2,添加gpadmin到/etc/sudoers
vim /etc/sudoers 编辑添加如下行
gpadmin ALL=(ALL) NOPASSWD:ALL
3, 配置gpadmin用户的ssh【免密互访】
参照上面root用户的设置进行。
九、 准备HAWQ2.3.0依赖软件包
1,hawq2.3.0所需必备软件包如下:
libgsasl is needed by apache-hawq-2.3.0.0-el7.x86_64 protobuf >= 2.5.0 is needed by apache-hawq-2.3.0.0-el7.x86_64 net-snmp-libs is needed by apache-hawq-2.3.0.0-el7.x86_64 thrift >= 0.9.1 is needed by apache-hawq-2.3.0.0-el7.x86_64 boost >= 1.53.0 is needed by apache-hawq-2.3.0.0-el7.x86_64
其中gcc gcc-c++ protobuf net-snmp-libs boots可直接安装。而安装libgsasl需要添加一个包含libgsasl库的源。
2,新建/etc/yum.repos.d/fedora.repo文件,添加如下内容:
[epel-repo] name=epel baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64/ enabled=1 gpgcheck=0
3,安装各个软件包:
yum install gcc gcc-c++ -y yum install protobuf -y yum install net-snmp-libs -y yum install boost -y yum install libgsasl-devel -y
yum install libevent -y
4,thrift 0.9.1需要下载安装包并使用rpm进行安装
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/t/thrift-0.9.1-15.el7.x86_64.rpm rpm -ivh thrift-0.9.1-15.el7.x86_64.rpm