2

Currently in our dev environment we have hardcoded the beeline connect string to something like

     beeline -u 'jdbc:hive2://zk0-hi-clu.3qy32mhqlj1ubaea5iyw5joamf.ax.internal.cloudapp.net:2181,zk1-hi-clu.3qy32mhqlj1ubaea5iyw5joamf.ax.internal.cloudapp.net:2181,zk6-hi-clu.3qy32mhqlj1ubaea5iyw5joamf.ax.internal.cloudapp.net:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2' --hivevar date=20190101 -f test.hql

I am trying to see if there are ways we can make the connect dynamic like it will look up a config file like odbc.ini. so when we promote the code to other environment, it will automatically connect to the correct target. Is this possible?

user3646699
  • 149
  • 4
  • 17

1 Answers1

0

Not exactly your case: I need some defaults in my shell and use the alias functionality of the bash.

export BEELINE_CONNECTION_STRING='jdbc:hive2://myzookeeper1:2181,myzookeeper2:2181,myzookeeper3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;'
alias beeline='beeline -u ${BEELINE_CONNECTION_STRING}'

After this typing beeline causes this:

beeline Connecting to jdbc:hive2://myzookeeper1:2181,myzookeeper2:2181,myzookeeper3:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2; Connected to: Apache Hive (version 1.2.1000.2.6.5.0-292) Driver: Hive JDBC (version 1.2.1000.2.6.5.0-292) Transaction isolation: TRANSACTION_REPEATABLE_READ Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive 0: jdbc:hive2://myhive>