-
Notifications
You must be signed in to change notification settings - Fork 26
Add Support for Configuring CCR Setup #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,14 @@ | ||
| cluster.name: "es-follow" | ||
|
|
||
| network.host: 0.0.0.0 | ||
|
|
||
| path: | ||
| data: /usr/share/elasticsearch/data | ||
| logs: /usr/share/elasticsearch/logs | ||
| repo: /usr/share/elasticsearch/repos | ||
|
|
||
| transport.port: 9301 | ||
| http.port: 9201 | ||
| remote_cluster.port: 9444 | ||
| http.max_content_length: 50mb | ||
| ingest.geoip.downloader.enabled: false |
This file contains hidden or 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 hidden or 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,89 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Function to display help | ||
| show_help() { | ||
| echo "Usage: $0 [option] [license]" | ||
| echo "Options:" | ||
| echo " up - Start the clusters and apply the license" | ||
| echo " down - Shut down the clusters" | ||
| echo " help - Display this help message" | ||
| } | ||
|
|
||
| # Function to apply the license to a cluster | ||
| apply_license() { | ||
| local port=$1 | ||
| local license="$2" | ||
| local response_file=$(mktemp) | ||
| local http_code | ||
| http_code=$(curl -s -o "$response_file" -w "%{http_code}" -X PUT "http://localhost:$port/_license?pretty" -H "Content-Type: application/json" -d "$license") | ||
|
|
||
| if [ "$http_code" -ne 200 ]; then | ||
| echo "Failed to apply license to cluster on port $port. HTTP status code: $http_code" | ||
| echo "Error response: $(cat "$response_file")" | ||
| rm "$response_file" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| # Function to shut down the clusters | ||
| shutdown_clusters() { | ||
| docker compose --project-directory docker --profile ccr down | ||
| echo "Clusters shut down." | ||
| } | ||
|
|
||
| # Check for options | ||
| case "$1" in | ||
| up) | ||
|
|
||
| # Get the directory of the current script | ||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
|
||
| # Start the clusters | ||
| docker compose --project-directory docker --profile ccr up -d | ||
|
|
||
| # Wait for both clusters to be online | ||
| export ES_PORT=9208 | ||
| "$SCRIPT_DIR/poll-for-es" | ||
| export ES_PORT=9209 | ||
| "$SCRIPT_DIR/poll-for-es" | ||
|
|
||
| # Apply the license to both clusters | ||
| LICENSE=$2 | ||
| if [ -z "$LICENSE" ]; then | ||
| echo "License key is required as the second argument." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Applying license to cluster on port 9208..." | ||
| apply_license 9208 "$LICENSE" | ||
| echo "Applying license to cluster on port 9209..." | ||
| apply_license 9209 "$LICENSE" | ||
| echo "License applied to both clusters." | ||
|
|
||
| # Set up the remote connection between the clusters | ||
| curl -X PUT "http://localhost:9209/_cluster/settings" -H "Content-Type: application/json" -d '{ | ||
| "persistent": { | ||
| "cluster": { | ||
| "remote": { | ||
| "cluster_one": { | ||
| "seeds": ["es8.13:9300"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }' | ||
|
|
||
| echo "Clusters setup completed." | ||
| ;; | ||
| down) | ||
| shutdown_clusters | ||
| ;; | ||
| help) | ||
| show_help | ||
| ;; | ||
| *) | ||
| echo "Invalid option: $1" | ||
| show_help | ||
| exit 1 | ||
| ;; | ||
| esac |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we upgrade this to 1G for XMX & XMS? I've seen flakyness before with this little memory assigned to the JVM.