使用yum源安装CDH Hadoop集群(8)

$ yum install postgresql-server postgresql-jdbc -y $ ln -s /usr/share/Java/postgresql-jdbc.jar /usr/lib/hive/lib/postgresql-jdbc.jar

配置开启启动,并初始化数据库:

$ chkconfig postgresql on $ service postgresql initdb

修改配置文件postgresql.conf,修改完后内容如下:

$ cat /var/lib/pgsql/data/postgresql.conf | grep -e listen -e standard_conforming_strings listen_addresses = '*' standard_conforming_strings = off

修改 /var/lib/pgsql/data/pg_hba.conf,添加以下一行内容:

host all all 0.0.0.0/0 trust

创建数据库和用户,设置密码为hive:

su -c "cd ; /usr/bin/pg_ctl start -w -m fast -D /var/lib/pgsql/data" postgres su -c "cd ; /usr/bin/psql --command \"create user hive with password 'hive'; \" " postgres su -c "cd ; /usr/bin/psql --command \"drop database hive;\" " postgres su -c "cd ; /usr/bin/psql --command \"CREATE DATABASE sentry owner=hive;\" " postgres su -c "cd ; /usr/bin/psql --command \"GRANT ALL privileges ON DATABASE hive TO hive;\" " postgres su -c "cd ; /usr/bin/pg_ctl restart -w -m fast -D /var/lib/pgsql/data" postgres

这时候的hive-site.xml文件内容如下:

<configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:postgresql://localhost/hive</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>org.postgresql.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> </property> <property> <name>datanucleus.autoCreateSchema</name> <value>false</value> </property> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>cdh1:8031</value> </property> <property> <name>hive.auto.convert.join</name> <value>true</value> </property> <property> <name>hive.metastore.schema.verification</name> <value>true</value> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>/user/hive/warehouse</value> </property> <property> <name>hive.warehouse.subdir.inherit.perms</name> <value>true</value> </property> <property> <name>hive.metastore.uris</name> <value>thrift://cdh1:9083</value> </property> <property> <name>hive.metastore.client.socket.timeout</name> <value>36000</value> </property> <property> <name>hive.support.concurrency</name> <value>true</value> </property> <property> <name>hive.zookeeper.quorum</name> <value>cdh1,cdh2,cdh3</value> </property> <property> <name>hive.server2.thrift.min.worker.threads</name> <value>5</value> </property> <property> <name>hive.server2.thrift.max.worker.threads</name> <value>100</value> </property> </configuration>

默认情况下,hive-server和 hive-server2 的 thrift 端口都为10000,如果要修改 hive-server2 thrift 端口,请修改 hive.server2.thrift.port 参数的值。

如果要设置运行 hive 的用户为连接的用户而不是启动用户,则添加:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/db4a7121584d8905dd7ecca24b051cac.html