Invalid host port specified for setting hosts – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when the host port specified in the Elasticsearch configuration is invalid. This could be due to a typo, incorrect format, or the port being used by another service. To resolve this issue, you can check the Elasticsearch configuration file for any errors in the host port specification. Ensure the port is available and not being used by another service. If necessary, change the port to a valid, unused one. Also, ensure the format is correct, typically it should be ‘hostname:port’.

This guide will help you check for common problems that cause the log ” invalid host:port specified: [{}] for setting [{}.hosts] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, index.

Log Context

Log “invalid host:port specified: [{}] for setting [{}.hosts]” classname is IndexAuditTrail.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        List> hostPortPairs = new ArrayList();

        for (String host : hosts) {
            List hostPort = Arrays.asList(host.trim().split(":"));
            if (hostPort.size() != 1 && hostPort.size() != 2) {
                logger.warn("invalid host:port specified: [{}] for setting [{}.hosts]"; REMOTE_CLIENT_SETTINGS.getKey(); host);
            }
            hostPortPairs.add(new Tuple(hostPort.get(0); hostPort.size() == 2 ? Integer.valueOf(hostPort.get(1)) : 9300));
        }

        if (hostPortPairs.size() == 0) {

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?