hive配置远程metastore的方法:
1)首先配置hive使用本地mysql存储metastore(服务器A 111.121.21.23)(也可以使用远程mysql存储)
2)配置完成后,在服务器A启动服务:bin/hive --service metastore (默认监听端口是:9083)
3)配置hive客户端,修改hive-site.xml:(服务器B-需要有hadoop环境)
<property>
<name>hive.metastore.local</name>
<value>false</value>
<description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM</description>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://111.121.21.23:9083</value>
<description></description>
</property>
4)运行:bin/hive ,执行测试hql
5)hive客户端连接成功后,hive服务器端输出以下日志:
Starting Hive Metastore Server
11/10/31 18:07:27 INFO metastore.HiveMetaStore: 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
11/10/31 18:07:27 INFO metastore.ObjectStore: ObjectStore, initialize called
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.resources" but it cannot be resolved.
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.core.runtime" but it cannot be resolved.
11/10/31 18:07:27 ERROR DataNucleus.Plugin: Bundle "org.eclipse.jdt.core" requires "org.eclipse.text" but it cannot be resolved.
11/10/31 18:07:27 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
11/10/31 18:07:27 INFO DataNucleus.Persistence: Property javax.jdo.option.NonTransactionalRead unknown - will be ignored
11/10/31 18:07:27 INFO DataNucleus.Persistence: ================= Persistence Configuration ===============
11/10/31 18:07:27 INFO DataNucleus.Persistence: DataNucleus Persistence Factory - Vendor: "DataNucleus" Version: "2.0.3"
11/10/31 18:07:27 INFO DataNucleus.Persistence: DataNucleus Persistence Factory initialised for datastore URL="jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true" driver="com.mysql.jdbc.Driver" userName="hive"
11/10/31 18:07:27 INFO DataNucleus.Persistence: ===========================================================
11/10/31 18:07:28 INFO Datastore.Schema: Creating table `DELETEME1320055648261`
11/10/31 18:07:28 INFO Datastore.Schema: Schema Name could not be determined for this datastore
11/10/31 18:07:28 INFO Datastore.Schema: Dropping table `DELETEME1320055648261`
11/10/31 18:07:28 INFO Datastore.Schema: Initialising Catalog "hive", Schema "" using "None" auto-start option
11/10/31 18:07:28 INFO Datastore.Schema: Catalog "hive", Schema "" initialised - managing 0 classes
11/10/31 18:07:28 INFO metastore.ObjectStore: Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order"
11/10/31 18:07:28 INFO DataNu