forked from elastic/elasticsearch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tribe: Fix tribe node to load config file for internal client nodes
The tribe node creates one local client node for each cluster it connects to. Refactorings in elastic#13383 broke this so that each local client node now tries to load the full elasticsearch.yml that the real tribe node uses. This change fixes the problem by adding a TribeClientNode which is a subclass of Node. The Environment the node uses is now passed in (in place of Settings), and the TribeClientNode simply does not use InternalSettingsPreparer.prepareEnvironment. The tests around tribe nodes are not great. The existing tests pass, but I also manually tested by creating 2 local clusters, and configuring and starting a tribe node. With this I was able to see in the logs the tribe node connecting to each cluster. closes elastic#13383
- Loading branch information
Showing
5 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
core/src/main/java/org/elasticsearch/tribe/TribeClientNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.tribe; | ||
|
||
import org.elasticsearch.Version; | ||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.env.Environment; | ||
import org.elasticsearch.node.Node; | ||
import org.elasticsearch.plugins.Plugin; | ||
|
||
import java.util.Collections; | ||
|
||
/** | ||
* An internal node that connects to a remove cluster, as part of a tribe node. | ||
*/ | ||
class TribeClientNode extends Node { | ||
TribeClientNode(Settings settings) { | ||
super(new Environment(settings), Version.CURRENT, Collections.<Class<? extends Plugin>>emptyList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters