hive相关配置

来源:互联网 发布:宁波指动网络董事长 编辑:程序博客网 时间:2024/05/16 05:26
hive的企业配置:
1、配置元数据的存储
-》derby数据库只能启动一个实例
-》配置使用mysql进行存储元数据
mysql热备
-》安装配置mysql
-》卸载自带的mysql-lib
-》安装  sudo yum install -y  mysql-server
要求:联网、yum源/etc/yum.repos.d/
-》检查
sudo service mysqld status
-》启动:
sudo service mysqld start
sudo chkconfig mysqld on
-》配置
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK


To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h hadoop-senior02.ibeifeng.com password 'new-password'


Alternatively you can run:
/usr/bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl


Please report any problems with the /usr/bin/mysqlbug script!


  [  OK  ]
Starting mysqld: 
 [  OK  ]

-》设置密码
mysqladmin -u root password '123456'
-》进入mysql
mysql  -uroot -p
-》设置用户连接权限:mysql-》user
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
delete  其他记录
flush privileges;
-》重启mysqld


-》配置hive
-》创建hive-site.xml
-》配置 
<property>
 <name>javax.jdo.option.ConnectionURL</name>
 <value>jdbc:mysql://hadoop-senior02.ibeifeng.com:3306/metastore?createDatabaseIfNotExist=true</value>
 <description>JDBC connect string for a JDBC metastore</description>
</property>
<property>
 <name>javax.jdo.option.ConnectionDriverName</name>
 <value>com.mysql.jdbc.Driver</value>
 <description>Driver class name for a JDBC metastore</description>
</property>
<property>
 <name>javax.jdo.option.ConnectionUserName</name>
 <value>root</value>
 <description>username to use against metastore database</description>
</property>
<property>
 <name>javax.jdo.option.ConnectionPassword</name>
 <value>123456</value>
 <description>password to use against metastore database</description>
</property>
-》放入mysql-jdbc驱动包到lib目录下


2、自定义数据仓库的位置(默认的/user/hive/warehouse)
-》在hive-site中定义
<property>
 <name>hive.metastore.warehouse.dir</name>
 <value>/user/hive/warehouse</value>
 <description>location of default database for the warehouse</description>
</property>


3、指定hive运行日志配置
-》mv hive-log4j.properties.template hive-log4j.properties
-》hive-log4j.properties
hive.root.logger=INFO,DRFA  :调节日志级别
hive.log.dir=/opt/modules/hive-0.13.1-bin/logs :日志存储位置
hive.log.file=hive.log
4、如何显示当前数据库及表头
<property>
 <name>hive.cli.print.header</name>
 <value>true</value>
 <description>Whether to print the names of the columns in query output.</description>
</property>


<property>
 <name>hive.cli.print.current.db</name>
 <value>true</value>
 <description>Whether to include the current database in the Hive prompt.</description>
</property>
0 0
原创粉丝点击