1.安装的presto0.223最新版是需要jdk1.8的,但是hadoop的jdk是1.7.所以新建presto的用户。安装jdk1.8到presto用户环境下。让presto在presto用户下执行。
2.presto的用户组需要添加hadoop,否则找不到presto服务的keytab文件。
3.ncmp安装hive_client会自动安装一次mysql,但是如果需要在主机运行指定的mysql.那么主机不能安装hive _client.但是presto的coordinator需要配置hive.client.所以不要在没有安装hive_client客户端主机下。将presto的coordinator安装到这台主机下。
1.1切换root权限/或者在有sudo权限的普通用户下新建presto
sudo useradd presto
1.2presto用户添加到hadoop组
sudo usermod -a -G hadoop presto
1.4查看用户是否添加成功
[外链图片转存失败(img-bVXDgXgC-1565246366293)(presto基于kerberos访问hive的安装.assets/1565165682227.png)]
1.3修改用户密码
[外链图片转存失败(img-XPDmTIPf-1565246366295)(presto基于kerberos访问hive的安装.assets/1565165575878.png)]
1.5添加sudo权限
[外链图片转存失败(img-KMWz5w6G-1565246366296)(presto基于kerberos访问hive的安装.assets/1565165725158.png)]
root权限下,修改/etc/sudoers文件。
添加presto ALL=(ALL) NOPASSWD: ALL
2.1上传jdk,解压tar包(),(这里我把jdk安装到了/home/presto。presto的家目录)
[外链图片转存失败(img-U8UTdcIa-1565246366298)(presto基于kerberos访问hive的安装.assets/1565165809360.png)]
tar -xvzf jdk-8u221-linux-x64.tar.gz -C ~/
[外链图片转存失败(img-8FdFwcpM-1565246366299)(presto基于kerberos访问hive的安装.assets/1565165881238.png)]
2.2配置用户的环境属性
vi .bashrc
[外链图片转存失败(img-uFoLaVqE-1565246366300)(presto基于kerberos访问hive的安装.assets/1565166013308.png)]
export JAVA_HOME=/home/presto/jdk1.8.0_221
export PATH=.: J A V A H O M E / b i n : JAVA_HOME/bin: JAVAHOME/bin:PATH
2.2.1使文件生效
source .bashrc
2.2.2查看jdk是否安装成功
[外链图片转存失败(img-h5HhYE1s-1565246366302)(presto基于kerberos访问hive的安装.assets/1565166176404.png)]
java -version
3.1下载presto-server-0.223.tar.gz上传到/home/presto
[外链图片转存失败(img-FKURVo46-1565246366303)(presto基于kerberos访问hive的安装.assets/1565167274597.png)]
3.2解压的路径(我是在/opt下创建module/目录,赋权chmod 777 /opt/module/,其实可以直接解压到/home/presto/目录下更好)
3.3解压完成
tar -xvzf ./presto-server-0.223.tar.gz -C /opt/module/
[外链图片转存失败(img-gr9ZeGey-1565246366304)(presto基于kerberos访问hive的安装.assets/1565167679930.png)]
3.4presto解压目录下,新建./etc/目录**。
mkdir ./etc
[外链图片转存失败(img-g3I5zbSF-1565246366307)(presto基于kerberos访问hive的安装.assets/1565168018469.png)]
注意(此文件夹下放置的是presto的配置文件。重要)
3.5***4大配置文件***
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data
新建etc/node.properties
[外链图片转存失败(img-Qc6Hy2dB-1565246366307)(presto基于kerberos访问hive的安装.assets/1565168808723.png)]
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
etc/jvm.config文件是启动java虚拟机的命令行的选项,因为文件不能被shell解释,所有注意不能使用空格和其他特殊的字符
etc/config.properties文件是presto节点的配置信息,非常重要。由于一个presto的节点可以单纯作为coordinator或者作为worker又或者同时作为coordinator和worker
最小的coordinator的配置如下。可以直接copy
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
最小的worker的配置如下。可以直接copy
coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery.uri=http://example.net:8080
只有单节点或者测试presto的可以采用下列的配置
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
coordinator 允许这个节点作为presto的协调器coordinator.作用在于从客户端接受请求并执行查询
node-scheduler.include-coordinator 允许调度任务在这个协调器上。
http-server.http.port presto节点内外部的通讯的节点。这里这里需要查找8080端口是否被占用,这里我设置为8081
query.max-memory 查询可以用到的最大的分布式内存容量,默认就行。
query.max-memory-per-node 查询可以在任何一台机器上使用的最大用户内存默认
query.max-total-memory-per-node 查询可以在任何一台机器上使用的最大用户和系统内存,其中系统内存是在执行期间由读取器、写入器和网络缓冲区等使用的内存,默认
discovery.uri presto集群向coordinator 注册自己节点的信息
/etc/log.properties日志配置
com.facebook.presto=INFO
后台启动服务
bin/launcher start
前台启动服务
bin/launcher run
查看presto是否启动成功
[外链图片转存失败(img-lqMVFmDY-1565246366308)(presto基于kerberos访问hive的安装.assets/1565227602852.png)]
coordinator协调器认证目的是为了coordinator可以通过https能够进行kerberos认证
无需对此项更改 /etc/krb5.conf,使用集群已经配置好的信息
[libdefaults]
renew_lifetime = 7d
forwardable = true
default_realm = NEWLAND.COM
ticket_lifetime = 24h
dns_lookup_realm = false
dns_lookup_kdc = false
default_ccache_name = /tmp/krb5cc_%{uid}
#default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
#default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
[domain_realm]
NEWLAND.COM = NEWLAND.COM
[logging]
default = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
kdc = FILE:/var/log/krb5kdc.log
[realms]
NEWLAND.COM = {
admin_server = ncmp246
kdc = ncmp246
}
presto coordinator 协调器需要有kerberos实体,用于连接presto coordinator
sudo kadmin.local
addprinc -randkey presto/[email protected]
ktadd -k /etc/presto/presto.keytab presto/[email protected]
Java加密扩展策略文件Java运行时环境附带的策略文件限制了可以使用的加密密钥的强度。
US_export_policy.jar和local_policy.jar放置到$JAVA_HOME/jre/lib/security目录下
cd $JAVA_HOME/jre/lib/security
[外链图片转存失败(img-N9Rgkk7P-1565246366309)(presto基于kerberos访问hive的安装.assets/1565230133442.png)]
通过https访问presto coordinator使用kerberos认证的时候需要在coordinator 上创建一个Java keystore File
cd ~
keytool -genkeypair -alias presto -keyalg RSA -keystore keystore.jks
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: presto-coordinator.example.com
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=presto-coordinator.example.com, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
验证密钥存储文件的密码,并使用keytool查看其内容
keytool -list -v -keystore ~/presto.jks
Kerberos身份验证是在协调器节点的配置中配置的。属性文件。下面列出了需要添加的条目
http-server.authentication.type=KERBEROS
http.server.authentication.krb5.service-name=presto
http.server.authentication.krb5.service-hostname=presto.example.com
http.server.authentication.krb5.keytab=/etc/presto/presto.keytab
http.authentication.krb5.config=/etc/krb5.conf
http-server.https.enabled=true
http-server.https.port=7778
http-server.https.keystore.path=/etc/presto_keystore.jks
http-server.https.keystore.key=keystore_password
$ kinit -kt /etc/presto/presto.keytab presto/[email protected]
$ klist
etc/catalog/hive.config创建hive连接器
#基于hadoop2.x的配置
#连接器名/hive.metastore的地址/端口
connector.name=hive-hadoop2
hive.metastore.uri=thrift://10.1.8.247:9083
#namenode高可用
hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
#Hive Metastore Thrift Service Authentication
hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=hive/[email protected]
hive.metastore.client.principal=hive/[email protected]
hive.metastore.client.keytab=/etc/security/keytabs/hive.service.keytab
#Hdfs Authentication
hive.hdfs.authentication.type=KERBEROS
hive.hdfs.presto.principal=nn/[email protected]
hive.hdfs.presto.keytab=/etc/security/keytabs/nn.service.keytab
#hdfs导线加密
hive.hdfs.wire-encryption.enabled=true
bin/launcher start
下载presto-cli-0.223-executable.jar
mv presto-cli-0.223-executable.jar presto
赋予执行权限
chmod 770 presto
运行presto,在ncmp247机器上,执行下面命令即可,或者history | grep presto去查找历史记录
presto --server ncmp247:8081 --catalog hive --schema default
[外链图片转存失败(img-c1IO1WUq-1565246366309)(presto基于kerberos访问hive的安装.assets/1565244507739.png)]
1.安装的presto0.223最新版是需要jdk1.8的,但是hadoop的jdk是1.7.所以新建presto的用户。安装jdk1.8到presto用户环境下。让presto在presto用户下执行。
2.presto的用户组需要添加hadoop,否则找不到presto服务的keytab文件。
3.ncmp安装hive_client会自动安装一次mysql,但是如果需要在主机运行指定的mysql.那么主机不能安装hive _client.但是presto的coordinator需要配置hive.client.所以不要在没有安装hive_client客户端主机下。将presto的coordinator安装到这台主机下。
1.1切换root权限/或者在有sudo权限的普通用户下新建presto
sudo useradd presto
1.2presto用户添加到hadoop组
sudo usermod -a -G hadoop presto
1.4查看用户是否添加成功
[外链图片转存失败(img-iROnor8E-1565246367492)(presto基于kerberos访问hive的安装.assets/1565165682227.png)]
1.3修改用户密码
[外链图片转存失败(img-vzPBi0G6-1565246367492)(presto基于kerberos访问hive的安装.assets/1565165575878.png)]
1.5添加sudo权限
[外链图片转存失败(img-Lqf7am2Q-1565246367493)(presto基于kerberos访问hive的安装.assets/1565165725158.png)]
root权限下,修改/etc/sudoers文件。
添加presto ALL=(ALL) NOPASSWD: ALL
2.1上传jdk,解压tar包(),(这里我把jdk安装到了/home/presto。presto的家目录)
[外链图片转存失败(img-cREev4Nu-1565246367494)(presto基于kerberos访问hive的安装.assets/1565165809360.png)]
tar -xvzf jdk-8u221-linux-x64.tar.gz -C ~/
[外链图片转存失败(img-A5Z3WN4s-1565246367495)(presto基于kerberos访问hive的安装.assets/1565165881238.png)]
2.2配置用户的环境属性
vi .bashrc
[外链图片转存失败(img-KmBjyadJ-1565246367496)(presto基于kerberos访问hive的安装.assets/1565166013308.png)]
export JAVA_HOME=/home/presto/jdk1.8.0_221
export PATH=.: J A V A H O M E / b i n : JAVA_HOME/bin: JAVAHOME/bin:PATH
2.2.1使文件生效
source .bashrc
2.2.2查看jdk是否安装成功
[外链图片转存失败(img-pKmXVZU9-1565246367496)(presto基于kerberos访问hive的安装.assets/1565166176404.png)]
java -version
3.1下载presto-server-0.223.tar.gz上传到/home/presto
[外链图片转存失败(img-wcMa6FRF-1565246367497)(presto基于kerberos访问hive的安装.assets/1565167274597.png)]
3.2解压的路径(我是在/opt下创建module/目录,赋权chmod 777 /opt/module/,其实可以直接解压到/home/presto/目录下更好)
3.3解压完成
tar -xvzf ./presto-server-0.223.tar.gz -C /opt/module/
[外链图片转存失败(img-aFQYe6yH-1565246367497)(presto基于kerberos访问hive的安装.assets/1565167679930.png)]
3.4presto解压目录下,新建./etc/目录**。
mkdir ./etc
[外链图片转存失败(img-5yyr5UBt-1565246367498)(presto基于kerberos访问hive的安装.assets/1565168018469.png)]
注意(此文件夹下放置的是presto的配置文件。重要)
3.5***4大配置文件***
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data
新建etc/node.properties
[外链图片转存失败(img-IPqrqHBF-1565246367498)(presto基于kerberos访问hive的安装.assets/1565168808723.png)]
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
etc/jvm.config文件是启动java虚拟机的命令行的选项,因为文件不能被shell解释,所有注意不能使用空格和其他特殊的字符
etc/config.properties文件是presto节点的配置信息,非常重要。由于一个presto的节点可以单纯作为coordinator或者作为worker又或者同时作为coordinator和worker
最小的coordinator的配置如下。可以直接copy
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
最小的worker的配置如下。可以直接copy
coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery.uri=http://example.net:8080
只有单节点或者测试presto的可以采用下列的配置
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
coordinator 允许这个节点作为presto的协调器coordinator.作用在于从客户端接受请求并执行查询
node-scheduler.include-coordinator 允许调度任务在这个协调器上。
http-server.http.port presto节点内外部的通讯的节点。这里这里需要查找8080端口是否被占用,这里我设置为8081
query.max-memory 查询可以用到的最大的分布式内存容量,默认就行。
query.max-memory-per-node 查询可以在任何一台机器上使用的最大用户内存默认
query.max-total-memory-per-node 查询可以在任何一台机器上使用的最大用户和系统内存,其中系统内存是在执行期间由读取器、写入器和网络缓冲区等使用的内存,默认
discovery.uri presto集群向coordinator 注册自己节点的信息
/etc/log.properties日志配置
com.facebook.presto=INFO
后台启动服务
bin/launcher start
前台启动服务
bin/launcher run
查看presto是否启动成功
[外链图片转存失败(img-VpHh1h9r-1565246367499)(presto基于kerberos访问hive的安装.assets/1565227602852.png)]
coordinator协调器认证目的是为了coordinator可以通过https能够进行kerberos认证
无需对此项更改 /etc/krb5.conf,使用集群已经配置好的信息
[libdefaults]
renew_lifetime = 7d
forwardable = true
default_realm = NEWLAND.COM
ticket_lifetime = 24h
dns_lookup_realm = false
dns_lookup_kdc = false
default_ccache_name = /tmp/krb5cc_%{uid}
#default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
#default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
[domain_realm]
NEWLAND.COM = NEWLAND.COM
[logging]
default = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
kdc = FILE:/var/log/krb5kdc.log
[realms]
NEWLAND.COM = {
admin_server = ncmp246
kdc = ncmp246
}
presto coordinator 协调器需要有kerberos实体,用于连接presto coordinator
sudo kadmin.local
addprinc -randkey presto/[email protected]
ktadd -k /etc/presto/presto.keytab presto/[email protected]
Java加密扩展策略文件Java运行时环境附带的策略文件限制了可以使用的加密密钥的强度。
US_export_policy.jar和local_policy.jar放置到$JAVA_HOME/jre/lib/security目录下
cd $JAVA_HOME/jre/lib/security
[外链图片转存失败(img-iiNzpY2O-1565246367499)(presto基于kerberos访问hive的安装.assets/1565230133442.png)]
通过https访问presto coordinator使用kerberos认证的时候需要在coordinator 上创建一个Java keystore File
cd ~
keytool -genkeypair -alias presto -keyalg RSA -keystore keystore.jks
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: presto-coordinator.example.com
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=presto-coordinator.example.com, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
验证密钥存储文件的密码,并使用keytool查看其内容
keytool -list -v -keystore ~/presto.jks
Kerberos身份验证是在协调器节点的配置中配置的。属性文件。下面列出了需要添加的条目
http-server.authentication.type=KERBEROS
http.server.authentication.krb5.service-name=presto
http.server.authentication.krb5.service-hostname=presto.example.com
http.server.authentication.krb5.keytab=/etc/presto/presto.keytab
http.authentication.krb5.config=/etc/krb5.conf
http-server.https.enabled=true
http-server.https.port=7778
http-server.https.keystore.path=/etc/presto_keystore.jks
http-server.https.keystore.key=keystore_password
$ kinit -kt /etc/presto/presto.keytab presto/[email protected]
$ klist
etc/catalog/hive.config创建hive连接器
#基于hadoop2.x的配置
#连接器名/hive.metastore的地址/端口
connector.name=hive-hadoop2
hive.metastore.uri=thrift://10.1.8.247:9083
#namenode高可用
hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
#Hive Metastore Thrift Service Authentication
hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=hive/[email protected]
hive.metastore.client.principal=hive/[email protected]
hive.metastore.client.keytab=/etc/security/keytabs/hive.service.keytab
#Hdfs Authentication
hive.hdfs.authentication.type=KERBEROS
hive.hdfs.presto.principal=nn/[email protected]
hive.hdfs.presto.keytab=/etc/security/keytabs/nn.service.keytab
#hdfs导线加密
hive.hdfs.wire-encryption.enabled=true
bin/launcher start
下载presto-cli-0.223-executable.jar
mv presto-cli-0.223-executable.jar presto
赋予执行权限
chmod 770 presto
运行presto,在ncmp247机器上,执行下面命令即可,或者history | grep presto去查找历史记录
presto --server ncmp247:8081 --catalog hive --schema default
[外链图片转存失败(img-OBR2qFBg-1565246367500)(presto基于kerberos访问hive的安装.assets/1565244507739.png)]
1.安装的presto0.223最新版是需要jdk1.8的,但是hadoop的jdk是1.7.所以新建presto的用户。安装jdk1.8到presto用户环境下。让presto在presto用户下执行。
2.presto的用户组需要添加hadoop,否则找不到presto服务的keytab文件。
3.ncmp安装hive_client会自动安装一次mysql,但是如果需要在主机运行指定的mysql.那么主机不能安装hive _client.但是presto的coordinator需要配置hive.client.所以不要在没有安装hive_client客户端主机下。将presto的coordinator安装到这台主机下。
1.1切换root权限/或者在有sudo权限的普通用户下新建presto
sudo useradd presto
1.2presto用户添加到hadoop组
sudo usermod -a -G hadoop presto
1.4查看用户是否添加成功
[外链图片转存失败(img-iaBXNepf-1565246367676)(presto基于kerberos访问hive的安装.assets/1565165682227.png)]
1.3修改用户密码
[外链图片转存失败(img-bdSKvJMu-1565246367677)(presto基于kerberos访问hive的安装.assets/1565165575878.png)]
1.5添加sudo权限
[外链图片转存失败(img-p5SsI9Md-1565246367678)(presto基于kerberos访问hive的安装.assets/1565165725158.png)]
root权限下,修改/etc/sudoers文件。
添加presto ALL=(ALL) NOPASSWD: ALL
2.1上传jdk,解压tar包(),(这里我把jdk安装到了/home/presto。presto的家目录)
[外链图片转存失败(img-dLgpR4Ni-1565246367678)(presto基于kerberos访问hive的安装.assets/1565165809360.png)]
tar -xvzf jdk-8u221-linux-x64.tar.gz -C ~/
[外链图片转存失败(img-XL7kevno-1565246367679)(presto基于kerberos访问hive的安装.assets/1565165881238.png)]
2.2配置用户的环境属性
vi .bashrc
[外链图片转存失败(img-E6C4cP5t-1565246367679)(presto基于kerberos访问hive的安装.assets/1565166013308.png)]
export JAVA_HOME=/home/presto/jdk1.8.0_221
export PATH=.: J A V A H O M E / b i n : JAVA_HOME/bin: JAVAHOME/bin:PATH
2.2.1使文件生效
source .bashrc
2.2.2查看jdk是否安装成功
[外链图片转存失败(img-O1d96TdD-1565246367680)(presto基于kerberos访问hive的安装.assets/1565166176404.png)]
java -version
3.1下载presto-server-0.223.tar.gz上传到/home/presto
[外链图片转存失败(img-8FhkZSmE-1565246367680)(presto基于kerberos访问hive的安装.assets/1565167274597.png)]
3.2解压的路径(我是在/opt下创建module/目录,赋权chmod 777 /opt/module/,其实可以直接解压到/home/presto/目录下更好)
3.3解压完成
tar -xvzf ./presto-server-0.223.tar.gz -C /opt/module/
[外链图片转存失败(img-AYcZuR5l-1565246367681)(presto基于kerberos访问hive的安装.assets/1565167679930.png)]
3.4presto解压目录下,新建./etc/目录**。
mkdir ./etc
[外链图片转存失败(img-43zwbmaC-1565246367682)(presto基于kerberos访问hive的安装.assets/1565168018469.png)]
注意(此文件夹下放置的是presto的配置文件。重要)
3.5***4大配置文件***
node.environment=production
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.data-dir=/var/presto/data
新建etc/node.properties
[外链图片转存失败(img-bDUE32rX-1565246367682)(presto基于kerberos访问hive的安装.assets/1565168808723.png)]
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
etc/jvm.config文件是启动java虚拟机的命令行的选项,因为文件不能被shell解释,所有注意不能使用空格和其他特殊的字符
etc/config.properties文件是presto节点的配置信息,非常重要。由于一个presto的节点可以单纯作为coordinator或者作为worker又或者同时作为coordinator和worker
最小的coordinator的配置如下。可以直接copy
coordinator=true
node-scheduler.include-coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
最小的worker的配置如下。可以直接copy
coordinator=false
http-server.http.port=8080
query.max-memory=50GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery.uri=http://example.net:8080
只有单节点或者测试presto的可以采用下列的配置
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=5GB
query.max-memory-per-node=1GB
query.max-total-memory-per-node=2GB
discovery-server.enabled=true
discovery.uri=http://example.net:8080
coordinator 允许这个节点作为presto的协调器coordinator.作用在于从客户端接受请求并执行查询
node-scheduler.include-coordinator 允许调度任务在这个协调器上。
http-server.http.port presto节点内外部的通讯的节点。这里这里需要查找8080端口是否被占用,这里我设置为8081
query.max-memory 查询可以用到的最大的分布式内存容量,默认就行。
query.max-memory-per-node 查询可以在任何一台机器上使用的最大用户内存默认
query.max-total-memory-per-node 查询可以在任何一台机器上使用的最大用户和系统内存,其中系统内存是在执行期间由读取器、写入器和网络缓冲区等使用的内存,默认
discovery.uri presto集群向coordinator 注册自己节点的信息
/etc/log.properties日志配置
com.facebook.presto=INFO
后台启动服务
bin/launcher start
前台启动服务
bin/launcher run
查看presto是否启动成功
[外链图片转存失败(img-dmSNd7hh-1565246367683)(presto基于kerberos访问hive的安装.assets/1565227602852.png)]
coordinator协调器认证目的是为了coordinator可以通过https能够进行kerberos认证
无需对此项更改 /etc/krb5.conf,使用集群已经配置好的信息
[libdefaults]
renew_lifetime = 7d
forwardable = true
default_realm = NEWLAND.COM
ticket_lifetime = 24h
dns_lookup_realm = false
dns_lookup_kdc = false
default_ccache_name = /tmp/krb5cc_%{uid}
#default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
#default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
[domain_realm]
NEWLAND.COM = NEWLAND.COM
[logging]
default = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
kdc = FILE:/var/log/krb5kdc.log
[realms]
NEWLAND.COM = {
admin_server = ncmp246
kdc = ncmp246
}
presto coordinator 协调器需要有kerberos实体,用于连接presto coordinator
sudo kadmin.local
addprinc -randkey presto/[email protected]
ktadd -k /etc/presto/presto.keytab presto/[email protected]
Java加密扩展策略文件Java运行时环境附带的策略文件限制了可以使用的加密密钥的强度。
US_export_policy.jar和local_policy.jar放置到$JAVA_HOME/jre/lib/security目录下
cd $JAVA_HOME/jre/lib/security
[外链图片转存失败(img-eA9tkAa2-1565246367684)(presto基于kerberos访问hive的安装.assets/1565230133442.png)]
通过https访问presto coordinator使用kerberos认证的时候需要在coordinator 上创建一个Java keystore File
cd ~
keytool -genkeypair -alias presto -keyalg RSA -keystore keystore.jks
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: presto-coordinator.example.com
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=presto-coordinator.example.com, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
验证密钥存储文件的密码,并使用keytool查看其内容
keytool -list -v -keystore ~/presto.jks
Kerberos身份验证是在协调器节点的配置中配置的。属性文件。下面列出了需要添加的条目
http-server.authentication.type=KERBEROS
http.server.authentication.krb5.service-name=presto
http.server.authentication.krb5.service-hostname=presto.example.com
http.server.authentication.krb5.keytab=/etc/presto/presto.keytab
http.authentication.krb5.config=/etc/krb5.conf
http-server.https.enabled=true
http-server.https.port=7778
http-server.https.keystore.path=/etc/presto_keystore.jks
http-server.https.keystore.key=keystore_password
$ kinit -kt /etc/presto/presto.keytab presto/[email protected]
$ klist
etc/catalog/hive.config创建hive连接器
#基于hadoop2.x的配置
#连接器名/hive.metastore的地址/端口
connector.name=hive-hadoop2
hive.metastore.uri=thrift://10.1.8.247:9083
#namenode高可用
hive.config.resources=/etc/hadoop/conf/core-site.xml,/etc/hadoop/conf/hdfs-site.xml
#Hive Metastore Thrift Service Authentication
hive.metastore.authentication.type=KERBEROS
hive.metastore.service.principal=hive/[email protected]
hive.metastore.client.principal=hive/[email protected]
hive.metastore.client.keytab=/etc/security/keytabs/hive.service.keytab
#Hdfs Authentication
hive.hdfs.authentication.type=KERBEROS
hive.hdfs.presto.principal=nn/[email protected]
hive.hdfs.presto.keytab=/etc/security/keytabs/nn.service.keytab
#hdfs导线加密
hive.hdfs.wire-encryption.enabled=true
bin/launcher start
下载presto-cli-0.223-executable.jar
mv presto-cli-0.223-executable.jar presto
赋予执行权限
chmod 770 presto
运行presto,在ncmp247机器上,执行下面命令即可,或者history | grep presto去查找历史记录
presto --server ncmp247:8081 --catalog hive --schema default
[外链图片转存失败(img-NAcE1zvs-1565246367684)(presto基于kerberos访问hive的安装.assets/1565244507739.png)]