[
https://issues.apache.org/jira/browse/HIVE-14063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15357656#comment-15357656
]
Vihang Karajgaonkar commented on HIVE-14063:
--------------------------------------------
Thanks [~szehon] for your comment. I have attached first draft version of the
how the conf file may look like. We can add more documentation of each
parameter in the template file so that users can understand when each parameter
is used. A template file called beeline.conf.template can be provided in the
conf directory and user can use it as a template to create the beeline.conf at
pre-defined set of locations (need to be determined)
beeline.properties file is used to store the properties which include
lastConnectedUrl when the user issues a !save command from beeline command
line. Once it is saved the user can issue !reconnect to reconnect to the last
connected url. Another way to use default urls is to provide environment
variables starting with BEELINE_URL_<ID> and then issue beeline connect -u
<id>. Key point being user needs to either issue !reconnect or ./beeline
connect -u id command. The objective of providing a default conf file is to
provide seemless experience to the user so that he/she can connect directly by
issuing ./beeline (just like hiveCli)
Both these methods are orthogonal so that they both can be independently used
without affecting each other. User can choose one way or the other based on
their preference.
They can co-exist together too such that beeline.properties should take
precedence over beeline.conf file. The reason being user explicitly issues
!save command with the intention to reuse it by issuing !reconnect command. Eg.
if the user gets auto-connected using the beeline.conf file, and issues !save
it will create a ~/.beeline/beeline.properties and it will be used as long user
fires the !reconnect command. In such case the design should detect that
beeline.properties exists and it should not use the default conf file. Since
the user explicitly issued !save command earlier, as long as
~/.beeline/beeline.properties exists, that file will be used and user can
either issue !reconnect or the complete !connect -u .. url. If however,
beeline.properties does not exist, and beeline.conf exists, beeline will
attempt to initiate connection using the conf file. If none of the files are
present current behavior will continue.
[~spena] [~mohitsabharwal] [~sircodesalot] [~lskuff] please review and let us
know your thoughts. Feel free to include anyone who might be interested. Thanks!
> beeline to auto connect to the HiveServer2
> ------------------------------------------
>
> Key: HIVE-14063
> URL: https://issues.apache.org/jira/browse/HIVE-14063
> Project: Hive
> Issue Type: Improvement
> Components: Beeline
> Reporter: Vihang Karajgaonkar
> Assignee: Vihang Karajgaonkar
> Priority: Minor
>
> Currently one has to give an jdbc:hive2 url in order for Beeline to connect a
> hiveserver2 instance. It would be great if Beeline can get the info somehow
> (from a properties file at a well-known location?) and connect automatically
> if user doesn't specify such a url. If the properties file is not present,
> then beeline would expect user to provide the url and credentials using
> !connect or ./beeline -u .. commands
> While Beeline is flexible (being a mere JDBC client), most environments would
> have just a single HS2. Having users to manually connect into this via either
> "beeline ~/.propsfile" or -u or !connect statements is lowering the
> experience part.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)