Add client role to existing master node

Hi Experts,

I have 2 elasticsearch(7.16.2) monitoring cluster with 3 master + data eligible roles.
I want enabling CCR between them, I am following document for doing this integration.
CCR Link

I have run the below command as the above documents says.

PUT /_cluster/settings
{
  "persistent" : {
    "cluster" : {
      "remote" : {
        "leader" : {
          "seeds" : [
            "127.0.0.1:9300" 
          ]
        }
      }
    }
  }
}

After running the command I am getting the following output as

GET /_remote/info

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "node [es-mon-data1] does not have the [remote_cluster_client] role"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "node [es-mon-data1] does not have the [remote_cluster_client] role"
  },
  "status" : 400
}

I tried enabling the client node to my master node 3, but its giving error in elasticsearch.

[2022-09-05T13:19:25,979][INFO ][o.e.e.NodeEnvironment ] [es-mon-data3] heap size [30gb], compressed ordinary object pointers [true]
[2022-09-05T13:19:25,984][ERROR][o.e.b.Bootstrap ] [es-mon-data3] Exception
java.lang.IllegalArgumentException: unknown role [client]
at org.elasticsearch.cluster.node.DiscoveryNode.getRoleFromRoleName(DiscoveryNode.java:586) ~[elasticsearch-7.16.2.jar:7.16.2]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
at org.elasticsearch.common.settings.Setting.lambda$listSetting$46(Setting.java:1690) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.common.settings.Setting.get(Setting.java:491) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.common.settings.Setting.get(Setting.java:485) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cluster.node.DiscoveryNode.getRolesFromSettings(DiscoveryNode.java:273) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cluster.node.DiscoveryNode.canContainData(DiscoveryNode.java:95) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:348) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.node.Node.(Node.java:427) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) [elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) [elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) [elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) [elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) [elasticsearch-cli-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.Command.main(Command.java:77) [elasticsearch-cli-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) [elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) [elasticsearch-7.16.2.jar:7.16.2]
[2022-09-05T13:19:25,988][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [es-mon-data3] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown role [client]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:157) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.16.2.jar:7.16.2]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:122) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.16.2.jar:7.16.2]
Caused by: java.lang.IllegalArgumentException: unknown role [client]
at org.elasticsearch.cluster.node.DiscoveryNode.getRoleFromRoleName(DiscoveryNode.java:586) ~[elasticsearch-7.16.2.jar:7.16.2]
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
at org.elasticsearch.common.settings.Setting.lambda$listSetting$46(Setting.java:1690) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.common.settings.Setting.get(Setting.java:491) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.common.settings.Setting.get(Setting.java:485) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cluster.node.DiscoveryNode.getRolesFromSettings(DiscoveryNode.java:273) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.cluster.node.DiscoveryNode.canContainData(DiscoveryNode.java:95) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:348) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.node.Node.(Node.java:427) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.16.2.jar:7.16.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:166) ~[elasticsearch-7.16.2.jar:7.16.2]

Please help me to understand why its conflicting.

Thanks,
Tahseen

Edit elasticsearch.yml of each node and customize node.roles

  • Cross-cluster search and cross-cluster replication require the remote_cluster_client role.

Hi @ylasri ,

Thank you for your reply.
I followed the step you suggested, now I am bale to move ahead, but now I am getting this as connection not there.

I am getting this in both cluster.

Thanks,
Tahseen

Any message from logs ?
Are you using SSL for both cluster ?
If yes, check this Configure remote clusters with security | Elasticsearch Guide [8.4] | Elastic

Hi @ylasri ,

It was related to firewall blocked, I opened the firewall port. now its working fine.
I can able to see remote cluster data in primary cluster

Thank you,
Tahseen