相对于开源的Apache HAWQ,OushuDB的增强主要体现在以下方面:
节点数 |
可用内存(MB) |
磁盘空间(GB) |
1 |
1024 |
10 |
10 |
1024 |
20 |
50 |
2048 |
50 |
100 |
4096 |
100 |
300 |
4096 |
100 |
500 |
8096 |
200 |
1000 |
12288 |
200 |
主机名 |
IP |
hdp1 |
172.16.1.124 |
hdp2 |
172.16.1.125 |
hdp3 |
172.16.1.126 |
hdp4 |
172.16.1.127 |
名称 |
版本 |
操作系统 |
CentOS Linux release 7.2.1511 (Core) |
JDK |
openjdk version "1.8.0_65" |
数据库 |
MySQL 5.6.14 |
JDBC |
MySQL Connector Java 5.1.38 |
HDP |
2.5.3 |
Ambari |
2.4.2 |
# 查看JDK软件包列表
yum search java | grep -i --color JDK
# 安装JDK,如果没有java-1.8.0-openjdk-devel.x86_64就没有javac命令
yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 -y
# 查看当前值
ulimit -Sn
ulimit -Hn
# 如果小于10000,使用下面的命令设置成10000
ulimit -n 10000
(2)禁用防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
(3)禁用SELinux
setenforce 0
# 编辑/etc/selinux/config文件,设置
SELINUX=disabled
(4)配置域名解析
172.16.1.124 hdp1
172.16.1.125 hdp2
172.16.1.126 hdp3
172.16.1.127 hdp4
注意:不要删除文件中原有的如下两行,否则可能引起网络问题。
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
在hdp1上执行:
hostname hdp1
# 编辑/etc/sysconfig/network文件,设置如下两行:
NETWORKING=yes
HOSTNAME=hdp1
在hdp2、hdp3、hdp4上执行类似的配置。
yum install ntp -y
systemctl enable ntpd.service
systemctl start ntpd.service
(6)配置SSH免密码
ssh-keygen
... 一路回车 ...
ssh-copy-id hdp1
ssh-copy-id hdp2
ssh-copy-id hdp3
ssh-copy-id hdp4
在全部四台主机执行以下命令:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
(7)安装MySQL JDBC驱动
tar -zxvf mysql-connector-java-5.1.38.tar.gz
cp ./mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar /usr/share/java/mysql-connector-java.jar
(8)安装MySQL数据库
rpm -ivh MySQL-5.6.14-1.el6.x86_64.rpm
systemctl start mysql
(9)在hdp2上的MySQL中建立数据库用户并授权
# /home/mysql/mysql-5.6.14/bin/mysql -u root -p
delete from mysql.user where user='';
create database hive;
create database oozie;
create user 'hive'@'%' identified by 'hive';
grant all privileges on hive.* to 'hive'@'%';
create user 'oozie'@'%' identified by 'oozie';
grant all privileges on oozie.* to 'oozie'@'%';
flush privileges;
exit;
wget -P ~ http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/2.4.2.0/ambari-2.4.2.0-centos7.tar.gz
wget -P ~ http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.5.3.0/HDP-2.5.3.0-centos7-rpm.tar.gz
wget -P ~ http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos7/HDP-UTILS-1.1.0.21-centos7.tar.gz
(2)在hdp1上建立一个HTTP服务器
yum install httpd -y
mkdir -p /var/www/html/HDP-UTILS
tar -zxvf ~/ambari-2.4.2.0-centos7.tar.gz -C /var/www/html
tar -zxvf ~/HDP-2.5.3.0-centos7-rpm.tar.gz -C /var/www/html
tar -zxvf ~/HDP-UTILS-1.1.0.21-centos7.tar.gz -C /var/www/html/HDP-UTILS
systemctl enable httpd && systemctl start httpd
验证httd网站是否可用,可以使用links命令或者浏览器直接访问下面的地址,结果是看到刚才解压的目录:
links 172.16.1.124/AMBARI-2.4.2.0
links 172.16.1.124/HDP
links 172.16.1.124/HDP-UTILS
(3)安装本地源制作相关工具
yum install yum-utils createrepo -y
(4)在hdp1上配置ambari、HDP、HDP-UTILS的本地源
#VERSION_NUMBER=2.4.2.0-136
[Updates-ambari-2.4.2.0]
name=ambari-2.4.2.0 - Updates
baseurl=http://172.16.1.124/AMBARI-2.4.2.0/centos7/2.4.2.0-136
gpgcheck=1
gpgkey=http://172.16.1.124/AMBARI-2.4.2.0/centos7/2.4.2.0-136/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
新建/etc/yum.repos.d/hdp.repo文件,添加如下行:
#VERSION_NUMBER=2.5.3.0
[HDP-2.5]
name=HDP Version - HDP-2.5.3.0
baseurl=http://172.16.1.124/HDP/centos7
gpgcheck=1
gpgkey=http://172.16.1.124/HDP/centos7/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
[HDP-UTILS-1.1.0.21]
name=HDP Utils Version - HDP-UTILS-1.1.0.21
baseurl=http://172.16.1.124/HDP-UTILS
gpgcheck=1
gpgkey=http://172.16.1.124/HDP-UTILS/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1
(5)将新建的Repository配置文件从hdp1复制到其它主机
scp -r /etc/yum.repos.d/* root@hdp2:/etc/yum.repos.d/
scp -r /etc/yum.repos.d/* root@hdp3:/etc/yum.repos.d/
scp -r /etc/yum.repos.d/* root@hdp4:/etc/yum.repos.d/
(6)确认本地yum源
yum clean all
yum makecache
yum repolist
yum install ambari-server -y
# /home/mysql/mysql-5.6.14/bin/mysql -u root -p
delete from mysql.user where user='';
create user 'ambari'@'%' identified by 'ambari';
grant all privileges on *.* to 'ambari'@'%';
flush privileges;
exit;
(2)用ambari用户建立Ambari Server数据库模式
# /home/mysql/mysql-5.6.14/bin/mysql -u ambari -p
create database ambari;
use ambari;
source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
exit;
ambari-server setup
ambari-server start
# 查看Ambari Server进程状态
ambari-server status
控制台返回以下类似输出:
Using python /usr/bin/python
Ambari-server status
Ambari Server running
Found Ambari Server PID: 31100 at: /var/run/ambari-server/ambari-server.pid
至此,Ambari安装完成。
hdp1
hdp2
hdp3
hdp4
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
配置完成后点击“Test Connection”,hive元数据库测试成功如图6所示,Oozie服务器的数据库配置类似。
Falcon HTTP ERROR: 503 Problem accessing /index.html.
这是因为没有指定一个jdbc驱动,解决办法:
Property |
Setting |
dfs.allow.truncate |
true |
dfs.block.access.token.enable |
false for an unsecured HDFS cluster, or true for a secure cluster |
dfs.block.local-path-access.user |
gpadmin |
HDFS Short-circuit read |
true |
dfs.client.socket-timeout |
300000000 |
dfs.client.use.legacy.blockreader.local |
false |
dfs.datanode.handler.count |
60 |
dfs.datanode.socket.write.timeout |
7200000 |
dfs.namenode.handler.count |
600 |
dfs.support.append |
true |
dfs.datanode.max.transfer.threads |
40960 |
Property |
Setting |
ipc.client.connection.maxidletime |
3600000 |
ipc.client.connect.timeout |
300000 |
ipc.server.listen.queue.size |
3300 |
#Redhat/CentOS 7.0, 7.1, 7.2系统并且包含avx指令请配置以下YUM源:
wget -P /etc/yum.repos.d/ http://yum.oushu.io/oushurepo/oushudatabaserepo/centos7/3.1.1.0/oushu-database.repo
#Redhat/CentOS 7.0, 7.1, 7.2系统但不包含avx指令请配置以下YUM源:
wget -P /etc/yum.repos.d/ http://yum.oushu.io/oushurepo/oushudatabaserepo/centos7/3.1.1.0/oushu-database-noavx.repo
#Redhat/CentOS 7.3系统并且包含avx指令请配置以下YUM源:
wget -P /etc/yum.repos.d/ http://yum.oushu.io/oushurepo/oushudatabaserepo/centos7/3.1.1.0/oushu-database-cent73.repo
#Redhat/CentOS 7.3系统但不包含avx指令请配置以下YUM源:
wget -P /etc/yum.repos.d/ http://yum.oushu.io/oushurepo/oushudatabaserepo/centos7/3.1.1.0/oushu-database-cent73-noavx.repo
(2)在安装ambari server的物理机上(本次安装为hdp1)安装hawq ambari插件
sudo yum install oushu-database-ambari-plugin -y
cd /var/lib/hawq/
sudo ./add-hawq.py --stack HDP-2.5 --hawqrepo http://yum.oushu.io/oushurepo/yumrepo/release/oushu-database/centos7/3.1.1.0/release/
# 用户名密码请输入ambari登录用户名密码,默认都为admin::
sudo ambari-server restart
# 设置HAWQ环境变量
source /usr/local/hawq/greenplum_path.sh
psql -d postgres
create database test;
\c test
create table t (i int);
insert into t select generate_series(1,100);
\timing
select count(*) from t;
结果如图7所示。