一 、查看是否下载了相应的hive 的 jdbc版本,我用的是hive-jdbc-3.1.1.jar
二、更改hive-site.xml文件和core-site.xml 文件。
hive-site.xml文件更改:
javax.jdo.option.ConnectionURL jdbc:mysql://test50:3306/metastore?createDatabaseIfNotExist=true&useSSL=false JDBC connect string for a JDBC metastore javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver Driver class name for a JDBC metastore javax.jdo.option.ConnectionUserName 储存元数据的mysql用户名,一般是root username to use against metastore database javax.jdo.option.ConnectionPassword 元数据mysql密码 password to use against metastore database hive.metastore.schema.verification false hive.cli.print.current.db true hive.cli.print.header true hive.server2.thrift.port 10000 hive.server2.thrift.bind.host 192.168.152.50
core-site.xml更改:
注意:如果是hadoop集群,需要将集群中其他节点的core-site.xml文件全部更改
```xmlfs.defaultFS hdfs://test50:9000 hadoop.tmp.dir /opt/module/hadoopdata hadoop.proxyuser.(用户名:dwl).hosts * hadoop.proxyuser.(用户名:dwl).groups *
重启hadoop集群,然后用以下命令启动hive, ```bash [root@master ~]# hiveserver2 #或者 [root@master ~]# hive --service hiveserver2
当服务启动到这一步时,底下会卡着刷
Hive Session ID = ********
(有时候会刷个几分钟)再另开一个linux窗口,切换到当前用户下,执行
beeline命令
#进入beeline [root@master ~]# beeline #进入beeline后,连接10000端口 beeline> !connect jdbc:hive2://192.168.152.50:10000 Connecting to jdbc:hive2://192.168.152.50:10000 Enter username for jdbc:hive2://192.168.152.50:10000: dwl #用户名dwl Enter password for jdbc:hive2://192.168.152.50:10000: **** #密码为该用户在主节点的登陆密码如:3729********
至此,打开datagrip,连接hive就可以了。
datagrip连接hive的步骤文章如下:



