重启一下电脑,发现表不见了,原来我用的derby存储hive的meta,网上找了一下资料,说是要用mysql,
于是安装mysql
1 sudo apt-get install mysql-server
首先用root登陆给root用户赋予权限
1 $mysql -u root -p hive 2 mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "root";
拷贝mysql-connector-java-5.1.13.jar到hive的lib目录下
修改hive-site.xml的metastore的配置
1 <property> 2 3 <name>hive.metastore.warehouse.dir</name> 4 5 <value>/user/hive/warehouse</value> 6 7 </property> 8 9 <property> 10 11 <name>hive.metastore.local</name > 12 13 <value >true</value > 14 15 </property> 16 17 <property> 18 19 <name>javax.jdo.option.ConnectionURL</name> 20 21 <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value> 22 23 <description>JDBC connect string for a JDBC metastore</description> 24 25 </property> 26 27 <property> 28 29 <name>javax.jdo.option.ConnectionDriverName</name> 30 31 <value>com.mysql.jdbc.Driver</value> 32 33 <description>Driver class name for a JDBC metastore</description> 34 35 </property> 36 37 <property> 38 39 <name>javax.jdo.option.ConnectionUserName</name> 40 41 <value>root</value> 42 43 <description>username to use against metastore database</description> 44 45 </property> 46 47 <property> 48 49 <name>javax.jdo.option.ConnectionPassword</name> 50 51 <value>root</value> 52 53 <description>password to use against metastore database</description> 54 55 </property>
版权声明:本文为博主原创文章,未经博主允许不得转载。