Hi users:
Found the configuration "hive.server2.thrift.bind.host" does not work regardless of setting environment variable or hive-site.xml. It's always bind "0.0.0.0" after issue the command "hive --service hiveserver2" Take a look source code of 2.3.3 version. src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java The member variable hiveHost of ThriftCLIService can't be set value correctly, since the local variable hiveHost defined in init function. ...... protected int portNum; protected InetAddress serverIPAddress; protected String hiveHost; .......... public synchronized void init(HiveConf hiveConf) { this.hiveConf = hiveConf; String hiveHost = System.getenv("HIVE_SERVER2_THRIFT_BIND_HOST"); <------- local variable hiveHost to be set, but not be set for member variable hiveHost in init function. if (hiveHost == null) { hiveHost = hiveConf.getVar(ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST); } try { serverIPAddress = ServerUtils.getHostAddress(hiveHost); } catch (UnknownHostException e) { throw new ServiceException(e); } // Initialize common server configs needed in both binary & http modes String portString; // HTTP mode if (HiveServer2.isHTTPTransportMode(hiveConf)) { workerKeepAliveTime = hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_WORKER_KEEPALIVE_TIME, TimeUnit.SECONDS); portString = System.getenv("HIVE_SERVER2_THRIFT_HTTP_PORT"); if (portString != null) { portNum = Integer.parseInt(portString); } else { portNum = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT); } } // Binary mode else { workerKeepAliveTime = hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_WORKER_KEEPALIVE_TIME, TimeUnit.SECONDS); portString = System.getenv("HIVE_SERVER2_THRIFT_PORT"); if (portString != null) { portNum = Integer.parseInt(portString); <------- The member variable portNum assigned value correctly } else { portNum = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_PORT); <------- The member variable portNum assigned value correctly } } minWorkerThreads = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MIN_WORKER_THREADS); maxWorkerThreads = hiveConf.getIntVar(ConfVars.HIVE_SERVER2_THRIFT_MAX_WORKER_THREADS); super.init(hiveConf); } So, the subclass ThriftBinaryCLIService can't get value correctly. serverSocket = HiveAuthUtils.getServerSocket(hiveHost, portNum); <---hiveHost is member variable of parent class, but it's value is null . Thanks.