1.主机准备
root用户修改所有节点主机名配置文件/etc/hostname
修改配置文件/etc/hosts添加IP地址与主机名的映射关系
172.25.5.41 node01
172.25.5.42 node02
172.25.5.43 node03
root用户免密登录
root用户设置所有节点免密登录
所有节点执行如下命令生成id_rsa.pub
ssh-keygen -t rsa
在所有节点执行将自己的公钥拷贝到node01节点
node01
ssh-copy-id -i -f root@node01
node02
ssh-copy-id -i -f root@node01
node03
ssh-copy-id -i -f root@node01
node04
ssh-copy-id -i -f root@node01
node05
ssh-copy-id -i -f root@node01
从node01节点将所有公钥分发到所有节点
scp /root/.ssh/authorized_keys root@node02:/root/.ssh/
scp /root/.ssh/authorized_keys root@node03:/root/.ssh/
scp /root/.ssh/authorized_keys root@node04:/root/.ssh/
scp /root/.ssh/authorized_keys root@node05:/root/.ssh/
2.环境配置
root用户在所有节点执行解压后安装包中的脚本
时钟同步
root用户在所有节点设置时钟同步
crontab -e
*/1 * * * * /usr/sbin/ntpdate time1.aliyun.com
防火墙及selinux设置
sh setselinux_firewall.sh
#!/usr/bin/env bash
setselinux(){
echo '
# 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=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted'>/etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
}
安装jdk
sh java_install.sh
#!/bin/env bash
tar -zxvf ./jdk-8u261-linux-x64.tar.gz -C /usr/local
echo 'export JAVA_HOME=/usr/local/jdk1.8.0_261' >> /etc/profile
echo 'PATH=$PATH:$JAVA_HOME/bin' >> /etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar' >>/etc/profile
source /etc/profile
安装python3
sh python_install.sh
#!/usr/bin/env bash
yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel postgresql-devel*
mkdir -p /usr/local/python3
chmod -R 777 /usr/local/python3
tar -zxvf ./Python-3.6.3.tgz
cd ./Python-3.6.3
./configure --prefix=/usr/local/python3
make
make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
echo 'export PATH=$PATH:/usr/local/python3/bin' >> /etc/profile
source /etc/profile
pip3 install --upgrade pip3
pip3 install PyHive
pip3 install sqlalchemy
pip3 install pandas
pip3 install requests
pip3 install sasl
pip3 install thrift
pip3 install thrift-sasl
重启所有节点
reboot -h now
安装2.7pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
下载presto-admin2.5
wget https://github.com/prestodb/presto-admin/archive/2.5.tar.gz
安装presto-admin
tar zxvf /opt/presto-admin-2.5.tar.gz /root/
pip install -r requirements.txt
python setup.py develop
tar zxvf /opt/prestoadmindir.tar.gz -C /root/
修改presto的配置文件
修改/root/.prestoadmin/config.json为规划服务器
cat config.json
{
"username":"root",
"coordinator":"172.25.5.41",
"workers":[
"172.25.5.41",
"172.25.5.42",
"172.25.5.43"
],
"port":22
}
修改/root/.prestoadmin/coordinator/ config.properties
query.max-memory=1GB
node-scheduler.include-coordinator=true
discovery.uri=http://172.25.5.41:8080
discovery-server.enabled=true
http-server.http.port=8080
coordinator=true
query.max-memory-per-node=1GB
修改/root/.prestoadmin/workers/config.properties
query.max-memory=1GB
coordinator=false
query.max-memory-per-node=1GB
http-server.http.port=8080
discovery.uri=http://172.25.5.41:8080
5.安装presto server
presto-admin server install /opt/presto-server-rpm-0.224.rpm
[root@node01 ~]# presto-admin server install /opt/presto-server-rpm-0.224.rpm
Using rpm_specifier as a local path
Fetching local presto rpm at path: /opt/presto-server-rpm-0.224.rpm
Found existing rpm at: /opt/presto-server-rpm-0.224.rpm
Deploying rpm on 172.25.5.42...
Deploying rpm on 172.25.5.43...
Deploying rpm on 172.25.5.41...
Package deployed successfully on: 172.25.5.43
Package deployed successfully on: 172.25.5.42
Package deployed successfully on: 172.25.5.41
Package installed successfully on: 172.25.5.43
Deploying configuration on: 172.25.5.43
Package installed successfully on: 172.25.5.42
Deploying configuration on: 172.25.5.42
Package installed successfully on: 172.25.5.41
Deploying configuration on: 172.25.5.41
Deploying tpch.properties catalog configurations on: 172.25.5.43
Deploying tpch.properties catalog configurations on: 172.25.5.42
Deploying tpch.properties catalog configurations on: 172.25.5.41
[root@node01 ~]# presto-admin server start
[172.25.5.41] out: Starting presto
[172.25.5.41] out: Started as 8738
[172.25.5.41] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.41, please wai t. This check will time out after 2 minutes if the server does not respond.
[172.25.5.43] out: Starting presto
[172.25.5.43] out: Started as 29187
[172.25.5.43] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.43, please wai t. This check will time out after 2 minutes if the server does not respond.
[172.25.5.42] out: Starting presto
[172.25.5.42] out: Started as 2002
[172.25.5.42] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.42, please wai t. This check will time out after 2 minutes if the server does not respond.
Server started successfully on: 172.25.5.41
Server started successfully on: 172.25.5.43
Server started successfully on: 172.25.5.42
You have new mail in /var/spool/mail/root
[root@node01 ~]#
[root@node01 ~]# presto-admin server status
Server Status:
172.25.5.41(IP: 172.25.5.41, Roles: coordinator, worker): Running
Node URI(http): http://172.25.5.41:8080
Presto Version: 0.224-b3a49f7
Node status: active
Catalogs: system, tpch
Server Status:
172.25.5.42(IP: 172.25.5.42, Roles: worker): Running
Node URI(http): http://172.25.5.42:8080
Presto Version: 0.224-b3a49f7
Node status: active
Catalogs: system, tpch
Server Status:
172.25.5.43(IP: 172.25.5.43, Roles: worker): Running
Node URI(http): http://172.25.5.43:8080
Presto Version: 0.224-b3a49f7
Node status: active
Catalogs: system, tpch
presto-admin 升级presto
presto-admin server upgrade /opt/presto-server-rpm-0.238.rpm
[root@DM02 ~]# presto-admin server upgrade /opt/presto-server-rpm-0.238.rpm
[172.25.5.40] out: Stopping presto
[172.25.5.38] out: Stopping presto
[172.25.5.39] out: Stopping presto
[172.25.5.40] out: Stopped 12161
[172.25.5.40] out:
[172.25.5.39] out: Stopped 26087
[172.25.5.39] out:
[172.25.5.38] out: Stopped 26489
[172.25.5.38] out:
[172.25.5.40] out: /tmp/presto_config-sKedLHy.tar
[172.25.5.40] out:
Deploying rpm on 172.25.5.40...
[172.25.5.39] out: /tmp/presto_config-9TpPXn6.tar
[172.25.5.39] out:
Deploying rpm on 172.25.5.39...
[172.25.5.38] out: /tmp/presto_config-jFAShAu.tar
[172.25.5.38] out:
Deploying rpm on 172.25.5.38...
Package deployed successfully on: 172.25.5.39
Package deployed successfully on: 172.25.5.40
Package deployed successfully on: 172.25.5.38
Package upgraded successfully on: 172.25.5.40
[172.25.5.40] out: ./
[172.25.5.40] out: ./jvm.config
[172.25.5.40] out: ./log.properties
[172.25.5.40] out: ./node.properties
[172.25.5.40] out: ./env.sh
[172.25.5.40] out: ./catalog/
[172.25.5.40] out: ./catalog/tpch.properties
[172.25.5.40] out: ./catalog/uuu1900_xxooppp.properties
[172.25.5.40] out: ./catalog/postgres100_100.properties
[172.25.5.40] out: ./catalog/pg2020_2222.properties
[172.25.5.40] out: ./catalog/pg12345_12345.properties
[172.25.5.40] out: ./catalog/pg345_345.properties
[172.25.5.40] out: ./catalog/pg123455_123455.properties
[172.25.5.40] out: ./catalog/pg123456_12345.properties
[172.25.5.40] out: ./catalog/pg1234567_1234567.properties
[172.25.5.40] out: ./catalog/pg12333_12333.properties
[172.25.5.40] out: ./catalog/pg12444_12333.properties
[172.25.5.40] out: ./catalog/datasource40_55.properties
[172.25.5.40] out: ./config.properties
[172.25.5.40] out:
Package upgraded successfully on: 172.25.5.39
[172.25.5.39] out: ./
[172.25.5.39] out: ./jvm.config
[172.25.5.39] out: ./log.properties
[172.25.5.39] out: ./node.properties
[172.25.5.39] out: ./env.sh
[172.25.5.39] out: ./catalog/
[172.25.5.39] out: ./catalog/tpch.properties
[172.25.5.39] out: ./catalog/uuu1900_xxooppp.properties
[172.25.5.39] out: ./catalog/postgres100_100.properties
[172.25.5.39] out: ./catalog/pg2020_2222.properties
[172.25.5.39] out: ./catalog/pg12345_12345.properties
[172.25.5.39] out: ./catalog/pg345_345.properties
[172.25.5.39] out: ./catalog/pg123455_123455.properties
[172.25.5.39] out: ./catalog/pg123456_12345.properties
[172.25.5.39] out: ./catalog/pg1234567_1234567.properties
[172.25.5.39] out: ./catalog/pg12333_12333.properties
[172.25.5.39] out: ./catalog/pg12444_12333.properties
[172.25.5.39] out: ./catalog/datasource40_55.properties
[172.25.5.39] out: ./config.properties
[172.25.5.39] out:
Package upgraded successfully on: 172.25.5.38
[172.25.5.38] out: ./
[172.25.5.38] out: ./jvm.config
[172.25.5.38] out: ./log.properties
[172.25.5.38] out: ./node.properties
[172.25.5.38] out: ./env.sh
[172.25.5.38] out: ./catalog/
[172.25.5.38] out: ./catalog/tpch.properties
[172.25.5.38] out: ./catalog/uuu1900_xxooppp.properties
[172.25.5.38] out: ./catalog/postgres100_100.properties
[172.25.5.38] out: ./catalog/pg2020_2222.properties
[172.25.5.38] out: ./catalog/pg12345_12345.properties
[172.25.5.38] out: ./catalog/pg345_345.properties
[172.25.5.38] out: ./catalog/pg123455_123455.properties
[172.25.5.38] out: ./catalog/pg123456_12345.properties
[172.25.5.38] out: ./catalog/pg1234567_1234567.properties
[172.25.5.38] out: ./catalog/pg12333_12333.properties
[172.25.5.38] out: ./catalog/pg12444_12333.properties
[172.25.5.38] out: ./catalog/datasource40_55.properties
[172.25.5.38] out: ./config.properties
[172.25.5.38] out: ./catalogpg1900007_1900007.properties
[172.25.5.38] out:
[root@DM02 ~]#
[root@DM02 opt]# presto-admin server start
[172.25.5.40] out: Starting presto
[172.25.5.38] out: Starting presto
[172.25.5.40] out: Started as 6732
[172.25.5.40] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.40, please wait. This check will time out after 2 minutes if the server does not respond.
[172.25.5.39] out: Starting presto
[172.25.5.38] out: Started as 3857
[172.25.5.38] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.38, please wait. This check will time out after 2 minutes if the server does not respond.
[172.25.5.39] out: Started as 32472
[172.25.5.39] out:
Waiting to make sure we can connect to the Presto server on 172.25.5.39, please wait. This check will time out after 2 minutes if the server does not respond.
Server started successfully on: 172.25.5.38
Server started successfully on: 172.25.5.39
Server started successfully on: 172.25.5.40