Use the following command to start beeline and connect to a secure HiveServer2 process. In this example, the HiveServer2 process is running on localhost at port 12345:
$ /usr/lib/hive/bin/beeline
beeline> !connect jdbc:hive2://localhost:12345/default;principal=hive/HiveServer2Host@YOUR-REALM.COM
0: jdbc:hive2://localhost:10000/default>