Jetbrains DataGrip连接Hive2.3.6
先默认你已经装好了Hive,我之前连接失败主要是缺最后一条配置,具体配置如下:
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> 3 <configuration> 4 <property> 5 <name>javax.jdo.option.ConnectionURL</name> 6 <value>jdbc:mysql://kd-bd03:3306/metastore?createDatabaseIfNotExist=true</value> 7 </property> 8 9 <property> 10 <name>javax.jdo.option.ConnectionDriverName</name> 11 <value>com.mysql.jdbc.Driver</value> 12 </property> 13 14 <property> 15 <name>javax.jdo.option.ConnectionUserName</name> 16 <value>root</value> 17 </property> 18 19 <property> 20 <name>javax.jdo.option.ConnectionPassword</name> 21 <value>123456</value> 22 </property> 23 24 <property> 25 <name>hive.metastore.warehouse.dir</name> 26 <value>/user/hive/warehouse</value> 27 </property> 28 29 <property> 30 <name>hive.cli.print.header</name> 31 <value>true</value> 32 </property> 33 34 <property> 35 <name>hive.cli.print.current.db</name> 36 <value>true</value> 37 </property> 38 39 <property> 40 <name>hive.metastore.uris</name> 41 <value>thrift://kd-bd02:9083</value> 42 </property> 43 44 <property> 45 <name>hive.metastore.schema.verification</name> 46 <value>false</value> 47 </property> 48 49 <property> 50 <name>datanucleus.schema.autoCreateAll</name> 51 <value>true</value> 52 </property> 53 <property> 54 <name>hive.execution.engine</name> 55 <value>tez</value> 56 </property> 57 <property> 58 <name>hive.server2.enable.doAs</name> 59 <value>false</value> 60 </property> 61 </configuration>
然后打开DataGrip软件如下:
这里开始按下图把hive-jdbc的依赖加进来,安装包这里(链接https://pan.baidu.com/s/1sAvmRalGPBMXIgitW2-ltg,提取码1q0c)
然后去命令行,启动hiveserver,启动metastore(hive-1.2.1版本以后的,启动hiveserver2)
hadoop@kd-bd02:~/zhang/hive-2.3.6$ nohup hive --service metastore & hadoop@kd-bd02:~/zhang/hive-2.3.6$ nohup hive --service hiveserver2 &
再然后就可以尝试填写hostname,port,点击Test Connection试试了,如果想指定你连接的库,url那里最后加上"/databasename"就可以了
然后就可以用啦