首先是安装mysql
- 安装mysql数据库及客户端
yum install mysql-server
yum install mysql
servicemysqld start
步骤一: yum -y install mysql-server
步骤二:service mysqld start
步骤三:mysql -u root -p
Enter password: (默认是空密码,按enter)
mysql > CREATE USER 'hive'@'%' IDENTIFIED BY 'hive';
mysql > GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' WITH GRANT OPTION;
mysql > flush privileges;
mysql > exit;
2.配置server hive-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.57.6:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
</configuration>
2.客户端配置: hive-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>false</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://192.168.57.5:9083</value>
</property>
</configuration>
3.首先是测试本地:./bin hive
上面出现异常:将相应的mysql-connector-java-5.132.bin.jar拷贝到 apache-hive-1.2.1-bin/lib
4.再有异常就是jline..class 找不到,这时按下面要求去做:
5.首先是启动server 端: hive --service metastore
启动后客户端去访问:
注意:
注意! 多用户模式是先启动用hive –service metastoreserver 后,在用客户端去访问;在服务器上.hive 启动的是本地模式,新建的表和客户建立的表,不会共享
参考博客:http://www.cnblogs.com/zlslch/p/6025410.html