Hi,
When attempting to start cross cluster replication on an index, I’m getting this error written out the the follower logs. I get a 200 code back when making the start replication request however.
[ERROR] [c.a.e.r.t.s.ShardReplicationTask] [elasticsearch-replication-node2] [follower-01][0] Task failed due to ElasticsearchSecurityException[No user found for indices:data/read/opendistro/replication/changes]
The steps I’ve taken to set up replication are as follows:
- Installed elasticsearch, opendistro security and cross cluster replication plugins on 2 nodes.
- Set
opendistro_security.unsupported.inject_user.enabled: true
inelasticsearch.yml
- Set
opendistro_security.nodes_dn_dynamic_config_enabled: true
inelasticsearch.yml
- Set up
cluster.remote.leader_cluster_seeds
inelasticsearch.yml
- Set the permissions as described in the hadbook in
roles.yml
- Created an index on the leader node called ‘leader-01’.
- Added a document to the index.
(The handbook does not mention the below steps, but I was getting exceptions without performing them.)
- Created a snapshot repository called ‘opendistro-remote-repo-leader-cluster’ on the follower node.
- Created a snapshot called ‘opendistro-remote-snapshot’ for the index ‘leader-01’
- Started the replication by making a request to:
PUT https://localhost:9200/_opendistro/_replication/follower-01/_start
{
"remote_cluster": "leader_cluster",
"remote_index": "leader-01"
}
I have seen similar issues to this when the admin certificate is the same as the node certificate, however I am using different certificates, and can successfully run the securityadmin.sh
tool to reload the config.
When sending the start request, I am using the admin certificate to authenticate, and can confirm that this user has a role assigned to them that includes the indices:data/read/opendistro/replication/changes
permission by accessing the /_opendistro/_security/api/account
endpoint.
Note: For simplicity I have deployed both leader and follower roles to each node.
Response from /account
:
{
"user_name": "CN=Administrator",
...
"roles": [
...
"replication_backup_follower",
"replication_backup_leader"
...
]
}
Response from /roles
:
{
"replication_backup_leader": {
"cluster_permissions": [
"AS_DESCRIBED_IN_HANDBOOK"
],
"index_permissions": [
{
"index_patterns": [
"*"
],
"allowed_actions": [
...
"indices:data/read/opendistro/replication/changes"
]
}
]
},
"replication_backup_follower": {
"cluster_permissions": [
"AS_DESCRIBED_IN_HANDBOOK"
],
"index_permissions": [
{
"index_patterns": [
"*"
],
"allowed_actions": [
"AS_DESCRIBED_IN_HANDBOOK"
]
}
]
}
}