[Rename] refactor the distribution module. (#316)

Refactor the `distribution` module to rename elasticsearch to opensearch. The commit doesn't rename the files in the `src/bin` directory as git doesn't detect `git mv`, so that change will be done in a subsequent commit.

Signed-off-by: Rabi Panda <adnapibar@gmail.com>
This commit is contained in:
Rabi Panda 2021-03-16 01:53:48 -07:00 committed by Nick Knize
parent 7fd65d1d9e
commit 7c323133c7
90 changed files with 751 additions and 722 deletions

View File

@ -17,11 +17,11 @@
* under the License.
*/
apply plugin: 'elasticsearch.internal-distribution-archive-setup'
apply plugin: 'opensearch.internal-distribution-archive-setup'
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean jdk) {
return copySpec {
into("elasticsearch-${version}") {
into("opensearch-${version}") {
into('lib') {
with libFiles()
}
@ -129,7 +129,7 @@ distribution_archives {
subprojects {
apply plugin: 'distribution'
apply plugin: 'elasticsearch.internal-distribution-archive-check'
apply plugin: 'opensearch.internal-distribution-archive-check'
group = "org.elasticsearch.distribution.oss"
group = "org.opensearch.distribution.oss"
}

View File

@ -16,15 +16,15 @@
* specific language governing permissions and limitations
* under the License.
*/
import org.elasticsearch.gradle.MavenFilteringHack
import org.opensearch.gradle.MavenFilteringHack
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.rest-test'
// The integ-test-distribution is published to maven
apply plugin: 'elasticsearch.publish'
apply plugin: 'opensearch.publish'
group = "org.elasticsearch.distribution.integ-test-zip"
group = "org.opensearch.distribution.integ-test-zip"
integTest {
dependsOn assemble
@ -35,8 +35,8 @@ processTestResources {
MavenFilteringHack.filter(it, project(':distribution').restTestExpansions)
}
// make the pom file name use elasticsearch instead of the project name
archivesBaseName = "elasticsearch"
// make the pom file name use opensearch instead of the project name
archivesBaseName = "opensearch"
ext.buildDist = parent.tasks.named("buildIntegTestZip")
publishing {

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.test.rest;
package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request;
import org.opensearch.client.Response;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.test.rest;
package org.opensearch.test.rest;
import org.elasticsearch.common.logging.JsonLogsIntegTestCase;
import org.hamcrest.Matcher;

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.test.rest;
package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request;
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.test.rest;
package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.ResponseException;
import org.opensearch.client.Request;

View File

@ -17,9 +17,10 @@
* under the License.
*/
package org.elasticsearch.test.rest;
package org.opensearch.test.rest;
import org.apache.http.util.EntityUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.action.ActionFuture;
import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.client.Request;

View File

@ -19,12 +19,12 @@
import org.apache.tools.ant.filters.FixCrLfFilter
import org.elasticsearch.gradle.ConcatFilesTask
import org.elasticsearch.gradle.DependenciesInfoTask
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.NoticeTask
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.ConcatFilesTask
import org.opensearch.gradle.DependenciesInfoTask
import org.opensearch.gradle.MavenFilteringHack
import org.opensearch.gradle.NoticeTask
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.info.BuildParams
import java.nio.file.Files
import java.nio.file.Path
@ -41,7 +41,7 @@ tasks.register("generateDependenciesReport", ConcatFilesTask) {
dependsOn rootProject.allprojects.collect { it.tasks.withType(DependenciesInfoTask) }
files = fileTree(dir: project.rootDir, include: '**/dependencies.csv')
headerLine = "name,version,url,license,sourceURL"
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/es-dependencies.csv")
target = new File(System.getProperty('csv') ?: "${project.buildDir}/reports/dependencies/opensearch-dependencies.csv")
// explicitly add our dependency on the JDK
String jdkVersion = VersionProperties.versions.get('bundled_jdk')
@ -170,7 +170,7 @@ void copyModule(TaskProvider<Sync> copyTask, Project module) {
exclude 'config/log4j2.properties'
eachFile { details ->
String name = module.plugins.hasPlugin('elasticsearch.esplugin') ? module.esplugin.name : module.es_meta_plugin.name
String name = module.plugins.hasPlugin('opensearch.opensearchplugin') ? module.opensearchplugin.name : module.opensearch_meta_plugin.name
// Copy all non config/bin files
// Note these might be unde a subdirectory in the case of a meta plugin
if ((details.relativePath.pathString ==~ /([^\/]+\/)?(config|bin)\/.*/) == false) {
@ -275,8 +275,8 @@ project(':test:external-modules').subprojects.each { Project testModule ->
configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
apply plugin: 'elasticsearch.jdk-download'
apply plugin: 'elasticsearch.repositories'
apply plugin: 'opensearch.jdk-download'
apply plugin: 'opensearch.repositories'
// Setup all required JDKs
project.jdks {
@ -312,7 +312,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
dependencies {
libs project(':server')
libs project(':libs:elasticsearch-plugin-classloader')
libs project(':libs:opensearch-plugin-classloader')
libs project(':distribution:tools:java-version-checker')
libs project(':distribution:tools:launchers')
@ -461,7 +461,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
/**
* Build some variables that are replaced in the packages. This includes both
* scripts like bin/elasticsearch and bin/elasticsearch-plugin that a user might run and also
* scripts like bin/opensearch and bin/opensearch-plugin that a user might run and also
* scripts like postinst which are run as part of the installation.
*
* <dl>
@ -473,18 +473,18 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
* <dt>path.conf</dt>
* <dd>The default directory from which to load configuration. This is used in
* the packaging scripts, but in that context it is always
* /etc/elasticsearch. Its also used in bin/elasticsearch-plugin, where it is
* /etc/elasticsearch for the os packages but $ESHOME/config otherwise.</dd>
* /etc/opensearch. Its also used in bin/opensearch-plugin, where it is
* /etc/opensearch for the os packages but $OPENSEARCHHOME/config otherwise.</dd>
* <dt>path.env</dt>
* <dd>The env file sourced before bin/elasticsearch to set environment
* variables. Think /etc/defaults/elasticsearch.</dd>
* <dd>The env file sourced before bin/opensearch to set environment
* variables. Think /etc/defaults/opensearch.</dd>
* <dt>heap.min and heap.max</dt>
* <dd>Default min and max heap</dd>
* <dt>scripts.footer</dt>
* <dd>Footer appended to control scripts embedded in the distribution that is
* (almost) entirely there for cosmetic reasons.</dd>
* <dt>stopping.timeout</dt>
* <dd>RPM's init script needs to wait for elasticsearch to stop before
* <dd>RPM's init script needs to wait for opensearch to stop before
* returning from stop and it needs a maximum time to wait. This is it. One
* day. DEB retries forever.</dd>
* </dl>
@ -492,8 +492,8 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
subprojects {
ext.expansionsForDistribution = { distributionType, jdk ->
final String defaultHeapSize = "1g"
final String packagingPathData = "path.data: /var/lib/elasticsearch"
final String pathLogs = "/var/log/elasticsearch"
final String packagingPathData = "path.data: /var/lib/opensearch"
final String pathLogs = "/var/log/opensearch"
final String packagingPathLogs = "path.logs: ${pathLogs}"
final String packagingLoggc = "${pathLogs}/gc.log"
@ -508,9 +508,9 @@ subprojects {
'project.version': version,
'path.conf': [
'deb': '/etc/elasticsearch',
'rpm': '/etc/elasticsearch',
'def': '"$ES_HOME"/config'
'deb': '/etc/opensearch',
'rpm': '/etc/opensearch',
'def': '"$OPENSEARCH_HOME"/config'
],
'path.data': [
'deb': packagingPathData,
@ -518,16 +518,16 @@ subprojects {
'def': '#path.data: /path/to/data'
],
'path.env': [
'deb': '/etc/default/elasticsearch',
'rpm': '/etc/sysconfig/elasticsearch',
'deb': '/etc/default/opensearch',
'rpm': '/etc/sysconfig/opensearch',
/* There isn't one of these files for tar or zip but its important to
make an empty string here so the script can properly skip it. */
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; done',
],
'source.path.env': [
'deb': 'source /etc/default/elasticsearch',
'rpm': 'source /etc/sysconfig/elasticsearch',
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
'deb': 'source /etc/default/opensearch',
'rpm': 'source /etc/sysconfig/opensearch',
'def': 'if [ -z "$OPENSEARCH_PATH_CONF" ]; then OPENSEARCH_PATH_CONF="$OPENSEARCH_HOME"/config; fi',
],
'path.logs': [
'deb': packagingPathLogs,
@ -544,14 +544,14 @@ subprojects {
'heap.max': defaultHeapSize,
'heap.dump.path': [
'deb': "-XX:HeapDumpPath=/var/lib/elasticsearch",
'rpm': "-XX:HeapDumpPath=/var/lib/elasticsearch",
'deb': "-XX:HeapDumpPath=/var/lib/opensearch",
'rpm': "-XX:HeapDumpPath=/var/lib/opensearch",
'def': "-XX:HeapDumpPath=data"
],
'error.file': [
'deb': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
'rpm': "-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log",
'deb': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
'rpm': "-XX:ErrorFile=/var/log/opensearch/hs_err_pid%p.log",
'def': "-XX:ErrorFile=logs/hs_err_pid%p.log"
],
@ -566,14 +566,14 @@ subprojects {
'def': footer
],
'es.distribution.type': [
'opensearch.distribution.type': [
'deb': 'deb',
'rpm': 'rpm',
'tar': 'tar',
'zip': 'zip'
],
'es.bundled_jdk': [
'opensearch.bundled_jdk': [
'def': jdk ? 'true' : 'false'
],

View File

@ -17,10 +17,10 @@
* under the License.
*/
apply plugin:"elasticsearch.internal-distribution-bwc-setup"
apply plugin:"opensearch.internal-distribution-bwc-setup"
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.Version
import org.opensearch.gradle.info.BuildParams
BuildParams.getBwcVersions().forPreviousUnreleased { unreleasedVersion ->
@ -36,4 +36,4 @@ BuildParams.getBwcVersions().forPreviousUnreleased { unreleasedVersion ->
}
}
}
}
}

View File

@ -1,14 +1,14 @@
import org.elasticsearch.gradle.Architecture
import org.elasticsearch.gradle.DockerBase
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.docker.DockerBuildTask
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.testfixtures.TestFixturesPlugin
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.test.fixtures'
apply plugin: 'elasticsearch.internal-distribution-download'
apply plugin: 'elasticsearch.rest-resources'
import org.opensearch.gradle.Architecture
import org.opensearch.gradle.DockerBase
import org.opensearch.gradle.LoggedExec
import org.opensearch.gradle.VersionProperties
import org.opensearch.gradle.docker.DockerBuildTask
import org.opensearch.gradle.info.BuildParams
import org.opensearch.gradle.testfixtures.TestFixturesPlugin
apply plugin: 'opensearch.standalone-rest-test'
apply plugin: 'opensearch.test.fixtures'
apply plugin: 'opensearch.internal-distribution-download'
apply plugin: 'opensearch.rest-resources'
testFixtures.useFixture()
@ -33,23 +33,24 @@ ext.expansions = { Architecture architecture, DockerBase base, boolean local ->
throw new IllegalArgumentException("Unsupported architecture [" + architecture + "]")
}
} else {
/* When sourcing the Elasticsearch build remotely, the same Dockerfile needs
/* When sourcing the OpenSearch build remotely, the same Dockerfile needs
* to be able to fetch the artifact for any supported platform. We can't make
* the decision here. Bash will interpolate the `arch` command for us. */
classifier = "linux-\$(arch)"
}
final String elasticsearch = "elasticsearch-oss-${VersionProperties.elasticsearch}-${classifier}.tar.gz"
final String opensearch = "opensearch-oss-${VersionProperties.opensearch}-${classifier}.tar.gz"
/* Both the following Dockerfile commands put the resulting artifact at
* the same location, regardless of classifier, so that the commands that
* follow in the Dockerfile don't have to know about the runtime
* architecture. */
String sourceElasticsearch
String sourceOpenSearch
if (local) {
sourceElasticsearch = "COPY $elasticsearch /opt/elasticsearch.tar.gz"
sourceOpenSearch = "COPY $opensearch /opt/opensearch.tar.gz"
} else {
sourceElasticsearch = """
//TODO - replace the URL for OpenSearch when available
sourceOpenSearch = """
RUN curl --retry 8 -S -L \\
--output /opt/elasticsearch.tar.gz \\
https://artifacts-no-kpi.elastic.co/downloads/elasticsearch/$elasticsearch
@ -62,9 +63,9 @@ RUN curl --retry 8 -S -L \\
'git_revision' : BuildParams.gitRevision,
'license' : 'Apache-2.0',
'package_manager' : 'yum',
'source_elasticsearch': sourceElasticsearch,
'source_opensearch' : sourceOpenSearch,
'docker_base' : base.name().toLowerCase(),
'version' : VersionProperties.elasticsearch
'version' : VersionProperties.opensearch
]
}
@ -129,19 +130,19 @@ def createAndSetWritable(Object... locations) {
}
}
elasticsearch_distributions {
opensearch_distributions {
Architecture.values().each { eachArchitecture ->
"docker${ eachArchitecture == Architecture.AARCH64 ? '_aarch64' : '' }" {
architecture = eachArchitecture
type = 'docker'
version = VersionProperties.getElasticsearch()
version = VersionProperties.getOpenSearch()
failIfUnavailable = false // This ensures we don't attempt to build images if docker is unavailable
}
}
}
tasks.named("preProcessFixture").configure {
dependsOn elasticsearch_distributions.docker
dependsOn opensearch_distributions.docker
doLast {
// tests expect to have an empty repo
project.delete(
@ -178,10 +179,11 @@ void addBuildDockerImage(Architecture architecture, DockerBase base) {
dockerContext.fileProvider(copyContextTask.map { it.destinationDir })
baseImages = [ base.getImage() ]
String version = VersionProperties.elasticsearch
String version = VersionProperties.opensearch
tags = [
//TODO remove the tag and replace with OpenSearch docker tag
"docker.elastic.co/elasticsearch/elasticsearch-oss:${version}",
"elasticsearch-oss:test"
"opensearch-oss:test"
]
}
tasks.named("assemble").configure {
@ -220,11 +222,11 @@ subprojects { Project subProject ->
final String arch = architecture == Architecture.AARCH64 ? '-aarch64' : ''
final String suffix = '-oss'
final String extension = 'docker.tar'
final String artifactName = "elasticsearch${arch}${suffix}_test"
final String artifactName = "opensearch${arch}${suffix}_test"
final String exportTaskName = taskName("export", architecture, base, "DockerImage")
final String buildTaskName = taskName("build", architecture, base, "DockerImage")
final String tarFile = "${parent.projectDir}/build/${artifactName}_${VersionProperties.elasticsearch}.${extension}"
final String tarFile = "${parent.projectDir}/build/${artifactName}_${VersionProperties.opensearch}.${extension}"
tasks.register(exportTaskName, LoggedExec) {
inputs.file("${parent.projectDir}/build/markers/${buildTaskName}.marker")
@ -233,7 +235,7 @@ subprojects { Project subProject ->
args "save",
"-o",
tarFile,
"elasticsearch${suffix}:test"
"opensearch${suffix}:test"
dependsOn(parent.path + ":" + buildTaskName)
onlyIf { Architecture.current() == architecture }

View File

@ -55,48 +55,48 @@ services:
soft: -1
hard: -1
entrypoint: /docker-test-entrypoint.sh
elasticsearch-oss-1:
image: elasticsearch:test
opensearch-oss-1:
image: opensearch:test
environment:
- node.name=elasticsearch-oss-1
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2
- discovery.seed_hosts=elasticsearch-oss-2:9300
- cluster.name=elasticsearch-oss
- node.name=opensearch-oss-1
- cluster.initial_master_nodes=opensearch-oss-1,opensearch-oss-2
- discovery.seed_hosts=opensearch-oss-2:9300
- cluster.name=opensearch-oss
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/oss-repo:/tmp/es-repo
- ./build/logs/oss-1:/usr/share/elasticsearch/logs
- ./build/oss-repo:/tmp/opensearch-repo
- ./build/logs/oss-1:/usr/share/opensearch/logs
ports:
- "9200"
ulimits:
memlock:
soft: -1
hard: -1
elasticsearch-oss-2:
image: elasticsearch:test
opensearch-oss-2:
image: opensearch:test
environment:
- node.name=elasticsearch-oss-2
- cluster.initial_master_nodes=elasticsearch-oss-1,elasticsearch-oss-2
- discovery.seed_hosts=elasticsearch-oss-1:9300
- cluster.name=elasticsearch-oss
- node.name=opensearch-oss-2
- cluster.initial_master_nodes=opensearch-oss-1,opensearch-oss-2
- discovery.seed_hosts=opensearch-oss-1:9300
- cluster.name=opensearch-oss
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/es-repo
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
- path.repo=/tmp/opensearch-repo
- node.attr.testattr=test
- cluster.routing.allocation.disk.watermark.low=1b
- cluster.routing.allocation.disk.watermark.high=1b
- cluster.routing.allocation.disk.watermark.flood_stage=1b
- node.store.allow_mmap=false
volumes:
- ./build/oss-repo:/tmp/es-repo
- ./build/logs/oss-2:/usr/share/elasticsearch/logs
- ./build/oss-repo:/tmp/opensearch-repo
- ./build/logs/oss-2:/usr/share/opensearch/logs
ports:
- "9200"
ulimits:

View File

@ -1,5 +1,6 @@
#!/bin/bash
cd /usr/share/elasticsearch/bin/
cd /usr/share/opensearch/bin/
## TODO remove this line as it's x-pack
./elasticsearch-users useradd rest_user -p test-password -r superuser || true
echo "testnode" > /tmp/password
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/elasticsearch/logs/console.log
/usr/local/bin/docker-entrypoint.sh | tee > /usr/share/opensearch/logs/console.log

View File

@ -1,4 +1,4 @@
import org.elasticsearch.gradle.DockerBase
import org.opensearch.gradle.DockerBase
apply plugin: 'base'
@ -6,7 +6,7 @@ tasks.register("buildOssDockerBuildContext", Tar) {
archiveExtension = 'tar.gz'
compression = Compression.GZIP
archiveClassifier = "docker-build-context"
archiveBaseName = "elasticsearch-oss"
archiveBaseName = "opensearch-oss"
// Non-local builds don't need to specify an architecture.
with dockerBuildContext(null, DockerBase.CENTOS, false)
}

View File

@ -16,12 +16,12 @@
*/ %>
################################################################################
# Build stage 0 `builder`:
# Extract Elasticsearch artifact
# Extract OpenSearch artifact
################################################################################
FROM ${base_image} AS builder
# `tini` is a tiny but valid init for containers. This is used to cleanly
# control how ES and any child processes are shut down.
# control how OpenSearch and any child processes are shut down.
#
# The tini GitHub page gives instructions for verifying the binary using
# gpg, but the keyservers are slow to return the key and this can fail the
@ -40,22 +40,22 @@ RUN set -eux ; \\
mv \${tini_bin} /tini ; \\
chmod +x /tini
RUN mkdir /usr/share/elasticsearch
WORKDIR /usr/share/elasticsearch
RUN mkdir /usr/share/opensearch
WORKDIR /usr/share/opensearch
${source_elasticsearch}
RUN tar zxf /opt/elasticsearch.tar.gz --strip-components=1
RUN sed -i -e 's/ES_DISTRIBUTION_TYPE=tar/ES_DISTRIBUTION_TYPE=docker/' /usr/share/elasticsearch/bin/elasticsearch-env
RUN tar zxf /opt/opensearch.tar.gz --strip-components=1
RUN sed -i -e 's/OPENSEARCH_DISTRIBUTION_TYPE=tar/OPENSEARCH_DISTRIBUTION_TYPE=docker/' /usr/share/opensearch/bin/opensearch-env
RUN mkdir -p config config/jvm.options.d data logs
RUN chmod 0775 config config/jvm.options.d data logs
COPY config/elasticsearch.yml config/log4j2.properties config/
RUN chmod 0660 config/elasticsearch.yml config/log4j2.properties
COPY config/opensearch.yml config/log4j2.properties config/
RUN chmod 0660 config/opensearch.yml config/log4j2.properties
################################################################################
# Build stage 1 (the actual Elasticsearch image):
# Build stage 1 (the actual OpenSearch image):
#
# Copy elasticsearch from stage 0
# Copy opensearch from stage 0
# Add entrypoint
################################################################################
@ -72,27 +72,27 @@ RUN for iter in {1..10}; do \\
done; \\
(exit \$exit_code)
RUN groupadd -g 1000 elasticsearch && \\
adduser -u 1000 -g 1000 -G 0 -d /usr/share/elasticsearch elasticsearch && \\
chmod 0775 /usr/share/elasticsearch && \\
chown -R 1000:0 /usr/share/elasticsearch
RUN groupadd -g 1000 opensearch && \\
adduser -u 1000 -g 1000 -G 0 -d /usr/share/opensearch opensearch && \\
chmod 0775 /usr/share/opensearch && \\
chown -R 1000:0 /usr/share/opensearch
WORKDIR /usr/share/elasticsearch
COPY --from=builder --chown=1000:0 /usr/share/elasticsearch /usr/share/elasticsearch
WORKDIR /usr/share/opensearch
COPY --from=builder --chown=1000:0 /usr/share/opensearch /usr/share/opensearch
COPY --from=builder --chown=0:0 /tini /tini
# Replace OpenJDK's built-in CA certificate keystore with the one from the OS
# vendor. The latter is superior in several ways.
# REF: https://github.com/elastic/elasticsearch-docker/issues/171
RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/elasticsearch/jdk/lib/security/cacerts
RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/opensearch/jdk/lib/security/cacerts
ENV PATH /usr/share/elasticsearch/bin:\$PATH
ENV PATH /usr/share/opensearch/bin:\$PATH
COPY bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# The JDK's directories' permissions don't allow `java` to be executed under a different
# group to the default. Fix this.
RUN find /usr/share/elasticsearch/jdk -type d -exec chmod 0755 '{}' \\; && \\
RUN find /usr/share/opensearch/jdk -type d -exec chmod 0755 '{}' \\; && \\
chmod g=u /etc/passwd && \\
chmod 0775 /usr/local/bin/docker-entrypoint.sh
@ -123,7 +123,7 @@ LABEL org.label-schema.build-date="${build_date}" \\
ENTRYPOINT ["/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
# Dummy overridable parameter parsed by entrypoint
CMD ["eswrapper"]
CMD ["opensearchwrapper"]
################################################################################
# End of multi-stage Dockerfile

View File

@ -15,21 +15,21 @@ run_as_other_user_if_needed() {
fi
}
# Allow user specify custom CMD, maybe bin/elasticsearch itself
# for example to directly specify `-E` style parameters for elasticsearch on k8s
# Allow user specify custom CMD, maybe bin/opensearch itself
# for example to directly specify `-E` style parameters for opensearch on k8s
# or simply to run /bin/bash to check the image
if [[ "$1" != "eswrapper" ]]; then
if [[ "$(id -u)" == "0" && $(basename "$1") == "elasticsearch" ]]; then
if [[ "$1" != "opensearchwrapper" ]]; then
if [[ "$(id -u)" == "0" && $(basename "$1") == "opensearch" ]]; then
# centos:7 chroot doesn't have the `--skip-chdir` option and
# changes our CWD.
# Rewrite CMD args to replace $1 with `elasticsearch` explicitly,
# Rewrite CMD args to replace $1 with `opensearch` explicitly,
# so that we are backwards compatible with the docs
# from the previous Elasticsearch versions<6
# and configuration option D:
# https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html#_d_override_the_image_8217_s_default_ulink_url_https_docs_docker_com_engine_reference_run_cmd_default_command_or_options_cmd_ulink
# Without this, user could specify `elasticsearch -E x.y=z` but
# `bin/elasticsearch -E x.y=z` would not work.
set -- "elasticsearch" "${@:2}"
# Without this, user could specify `opensearch -E x.y=z` but
# `bin/opensearch -E x.y=z` would not work.
set -- "opensearch" "${@:2}"
# Use chroot to switch to UID 1000 / GID 0
exec chroot --userspec=1000:0 / "$@"
else
@ -43,12 +43,12 @@ fi
# point to it. This can be used to provide secrets to a container, without
# the values being specified explicitly when running the container.
#
# This is also sourced in elasticsearch-env, and is only needed here
# This is also sourced in opensearch-env, and is only needed here
# as well because we use ELASTIC_PASSWORD below. Sourcing this script
# is idempotent.
source /usr/share/elasticsearch/bin/elasticsearch-env-from-file
source /usr/share/opensearch/bin/opensearch-env-from-file
if [[ -f bin/elasticsearch-users ]]; then
if [[ -f bin/opensearch-users ]]; then
# Check for the ELASTIC_PASSWORD environment variable to set the
# bootstrap password for Security.
#
@ -56,18 +56,18 @@ if [[ -f bin/elasticsearch-users ]]; then
# enabled, but we have no way of knowing which node we are yet. We'll just
# honor the variable if it's present.
if [[ -n "$ELASTIC_PASSWORD" ]]; then
[[ -f /usr/share/elasticsearch/config/elasticsearch.keystore ]] || (run_as_other_user_if_needed elasticsearch-keystore create)
if ! (run_as_other_user_if_needed elasticsearch-keystore has-passwd --silent) ; then
[[ -f /usr/share/opensearch/config/opensearch.keystore ]] || (run_as_other_user_if_needed opensearch-keystore create)
if ! (run_as_other_user_if_needed opensearch-keystore has-passwd --silent) ; then
# keystore is unencrypted
if ! (run_as_other_user_if_needed elasticsearch-keystore list | grep -q '^bootstrap.password$'); then
(run_as_other_user_if_needed echo "$ELASTIC_PASSWORD" | elasticsearch-keystore add -x 'bootstrap.password')
if ! (run_as_other_user_if_needed opensearch-keystore list | grep -q '^bootstrap.password$'); then
(run_as_other_user_if_needed echo "$ELASTIC_PASSWORD" | opensearch-keystore add -x 'bootstrap.password')
fi
else
# keystore requires password
if ! (run_as_other_user_if_needed echo "$KEYSTORE_PASSWORD" \
| elasticsearch-keystore list | grep -q '^bootstrap.password$') ; then
| opensearch-keystore list | grep -q '^bootstrap.password$') ; then
COMMANDS="$(printf "%s\n%s" "$KEYSTORE_PASSWORD" "$ELASTIC_PASSWORD")"
(run_as_other_user_if_needed echo "$COMMANDS" | elasticsearch-keystore add -x 'bootstrap.password')
(run_as_other_user_if_needed echo "$COMMANDS" | opensearch-keystore add -x 'bootstrap.password')
fi
fi
fi
@ -76,8 +76,8 @@ fi
if [[ "$(id -u)" == "0" ]]; then
# If requested and running as root, mutate the ownership of bind-mounts
if [[ -n "$TAKE_FILE_OWNERSHIP" ]]; then
chown -R 1000:0 /usr/share/elasticsearch/{data,logs}
chown -R 1000:0 /usr/share/opensearch/{data,logs}
fi
fi
run_as_other_user_if_needed /usr/share/elasticsearch/bin/elasticsearch <<<"$KEYSTORE_PASSWORD"
run_as_other_user_if_needed /usr/share/opensearch/bin/opensearch <<<"$KEYSTORE_PASSWORD"

View File

@ -12,13 +12,13 @@ appender.deprecation_rolling.type = Console
appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
appender.deprecation_rolling.layout.opensearchmessagefields=x-opaque-id
appender.deprecation_rolling.filter.rate_limit.type = RateLimitingFilter
appender.header_warning.type = HeaderWarningAppender
appender.header_warning.name = header_warning
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.name = org.opensearch.deprecation
logger.deprecation.level = deprecation
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.appenderRef.header_warning.ref = header_warning
@ -28,7 +28,7 @@ appender.index_search_slowlog_rolling.type = Console
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
appender.index_search_slowlog_rolling.layout.type = ESJsonLayout
appender.index_search_slowlog_rolling.layout.type_name = index_search_slowlog
appender.index_search_slowlog_rolling.layout.esmessagefields=message,took,took_millis,total_hits,stats,search_type,total_shards,source,id
appender.index_search_slowlog_rolling.layout.opensearchmessagefields=message,took,took_millis,total_hits,stats,search_type,total_shards,source,id
logger.index_search_slowlog_rolling.name = index.search.slowlog
logger.index_search_slowlog_rolling.level = trace
@ -39,7 +39,7 @@ appender.index_indexing_slowlog_rolling.type = Console
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
appender.index_indexing_slowlog_rolling.layout.type = ESJsonLayout
appender.index_indexing_slowlog_rolling.layout.type_name = index_indexing_slowlog
appender.index_indexing_slowlog_rolling.layout.esmessagefields=message,took,took_millis,doc_type,id,routing,source
appender.index_indexing_slowlog_rolling.layout.opensearchmessagefields=message,took,took_millis,doc_type,id,routing,source
logger.index_indexing_slowlog.name = index.indexing.slowlog.index
logger.index_indexing_slowlog.level = trace
@ -85,7 +85,7 @@ appender.audit_rolling.layout.pattern = {\
%varsNotEmpty{, "rule":"%enc{%map{rule}}{JSON}"}\
%varsNotEmpty{, "event.category":"%enc{%map{event.category}}{JSON}"}\
}%n
# "node.name" node name from the `elasticsearch.yml` settings
# "node.name" node name from the `opensearch.yml` settings
# "node.id" node id which should not change between cluster restarts
# "host.name" unresolved hostname of the local node
# "host.ip" the local bound ip (i.e. the ip listening for connections)
@ -116,7 +116,7 @@ appender.audit_rolling.layout.pattern = {\
# "x_forwarded_for" the addresses from the "X-Forwarded-For" request header, as a verbatim string value (not an array)
# "transport.profile" name of the transport profile in case this is a "connection_granted" or "connection_denied" event
# "rule" name of the applied rule if the "origin.type" is "ip_filter"
# "event.category" fixed value "elasticsearch-audit"
# "event.category" fixed value "opensearch-audit"
logger.xmlsig.name = org.apache.xml.security.signature.XMLSignature
logger.xmlsig.level = error

View File

@ -17,7 +17,7 @@ appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation
appender.deprecation_rolling.filter.rate_limit.type = RateLimitingFilter
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.name = org.opensearch.deprecation
logger.deprecation.level = deprecation
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.appenderRef.header_warning.ref = header_warning

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.docker.test;
package org.opensearch.docker.test;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.opensearch.OpenSearchException;
@ -53,10 +53,10 @@ public class DockerYmlTestSuiteIT extends ESClientYamlSuiteTestCase {
protected String getTestRestCluster() {
return new StringBuilder()
.append("localhost:")
.append(getProperty("test.fixtures.elasticsearch-oss-1.tcp.9200"))
.append(getProperty("test.fixtures.opensearch-oss-1.tcp.9200"))
.append(",")
.append("localhost:")
.append(getProperty("test.fixtures.elasticsearch-oss-2.tcp.9200"))
.append(getProperty("test.fixtures.opensearch-oss-2.tcp.9200"))
.toString();
}
@ -69,7 +69,7 @@ public class DockerYmlTestSuiteIT extends ESClientYamlSuiteTestCase {
String value = System.getProperty(key);
if (value == null) {
throw new IllegalStateException("Could not find system properties from test.fixtures. " +
"This test expects to run with the elasticsearch.test.fixtures Gradle plugin");
"This test expects to run with the opensearch.test.fixtures Gradle plugin");
}
return value;
}

View File

@ -15,10 +15,10 @@
* KIND, either express or implied. See the License for the
*/
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.MavenFilteringHack
import org.elasticsearch.gradle.OS
import org.elasticsearch.gradle.info.BuildParams
import org.opensearch.gradle.LoggedExec
import org.opensearch.gradle.MavenFilteringHack
import org.opensearch.gradle.OS
import org.opensearch.gradle.info.BuildParams
import org.redline_rpm.header.Flags
import java.nio.file.Files
@ -47,8 +47,8 @@ import java.util.regex.Pattern
* The following commands are useful when it comes to check the user/group
* and files permissions set within the RPM and DEB packages:
*
* rpm -qlp --dump path/to/elasticsearch.rpm
* dpkg -c path/to/elasticsearch.deb
* rpm -qlp --dump path/to/opensearch.rpm
* dpkg -c path/to/opensearch.deb
*/
plugins {
@ -68,20 +68,20 @@ void addProcessFilesTask(String type, boolean jdk) {
MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk))
}
into('etc/elasticsearch') {
into('etc/opensearch') {
with configFiles(type, jdk)
}
MavenFilteringHack.filter(it, expansionsForDistribution(type, jdk))
doLast {
// create empty dirs, we set the permissions when configuring the packages
mkdir "${packagingFiles}/var/log/elasticsearch"
mkdir "${packagingFiles}/var/lib/elasticsearch"
mkdir "${packagingFiles}/usr/share/elasticsearch/plugins"
mkdir "${packagingFiles}/var/log/opensearch"
mkdir "${packagingFiles}/var/lib/opensearch"
mkdir "${packagingFiles}/usr/share/opensearch/plugins"
// bare empty dir for /etc/elasticsearch and /etc/elasticsearch/jvm.options.d
mkdir "${packagingFiles}/elasticsearch"
mkdir "${packagingFiles}/elasticsearch/jvm.options.d"
// bare empty dir for /etc/opensearch and /etc/opensearch/jvm.options.d
mkdir "${packagingFiles}/opensearch"
mkdir "${packagingFiles}/opensearch/jvm.options.d"
}
}
}
@ -100,7 +100,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
OS.current().equals(OS.WINDOWS) == false
}
dependsOn "processOss'${jdk ? '' : 'NoJdk'}${type.capitalize()}Files"
packageName "elasticsearch-oss"
packageName "opensearch-oss"
if (type == 'deb') {
if (architecture == 'x64') {
arch('amd64')
@ -117,7 +117,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
arch('aarch64')
}
}
// Follow elasticsearch's file naming convention
// Follow opensearch's file naming convention
String jdkString = jdk ? "" : "no-jdk-"
String prefix = "${architecture == 'aarch64' ? 'aarch64-' : ''}oss-${jdk ? '' : 'no-jdk-'}${type}"
destinationDirectory = file("${prefix}/build/distributions")
@ -138,7 +138,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
// top level "into" directive is not inherited from ospackage for some reason, so we must
// specify it again explicitly for copying common files
into('/usr/share/elasticsearch') {
into('/usr/share/opensearch') {
into('bin') {
with binFiles(type, jdk)
}
@ -183,7 +183,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
}
} else {
assert type == 'rpm'
into('/usr/share/elasticsearch') {
into('/usr/share/opensearch') {
from(rootProject.file('licenses')) {
include 'APACHE-LICENSE-2.0.txt'
rename { 'LICENSE.txt' }
@ -193,23 +193,23 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
}
// ========= config files =========
configurationFile '/etc/elasticsearch/elasticsearch.yml'
configurationFile '/etc/elasticsearch/jvm.options'
configurationFile '/etc/elasticsearch/log4j2.properties'
configurationFile '/etc/opensearch/opensearch.yml'
configurationFile '/etc/opensearch/jvm.options'
configurationFile '/etc/opensearch/log4j2.properties'
from("${packagingFiles}") {
dirMode 02750
into('/etc')
permissionGroup 'elasticsearch'
permissionGroup 'opensearch'
includeEmptyDirs true
createDirectoryEntry true
include("elasticsearch") // empty dir, just to add directory entry
include("elasticsearch/jvm.options.d") // empty dir, just to add directory entry
include("opensearch") // empty dir, just to add directory entry
include("opensearch/jvm.options.d") // empty dir, just to add directory entry
}
from("${packagingFiles}/etc/elasticsearch") {
into('/etc/elasticsearch')
from("${packagingFiles}/etc/opensearch") {
into('/etc/opensearch')
dirMode 02750
fileMode 0660
permissionGroup 'elasticsearch'
permissionGroup 'opensearch'
includeEmptyDirs true
createDirectoryEntry true
fileType CONFIG | NOREPLACE
@ -218,37 +218,37 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
configurationFile envFile
into(new File(envFile).getParent()) {
fileType CONFIG | NOREPLACE
permissionGroup 'elasticsearch'
permissionGroup 'opensearch'
fileMode 0660
from "${packagingFiles}/env/elasticsearch"
from "${packagingFiles}/env/opensearch"
}
// ========= systemd =========
into('/usr/lib/tmpfiles.d') {
from "${packagingFiles}/systemd/elasticsearch.conf"
from "${packagingFiles}/systemd/opensearch.conf"
fileMode 0644
}
into('/usr/lib/systemd/system') {
fileType CONFIG | NOREPLACE
from "${packagingFiles}/systemd/elasticsearch.service"
from "${packagingFiles}/systemd/opensearch.service"
fileMode 0644
}
into('/usr/lib/sysctl.d') {
fileType CONFIG | NOREPLACE
from "${packagingFiles}/systemd/sysctl/elasticsearch.conf"
from "${packagingFiles}/systemd/sysctl/opensearch.conf"
fileMode 0644
}
into('/usr/share/elasticsearch/bin') {
into('/usr/share/opensearch/bin') {
from "${packagingFiles}/systemd/systemd-entrypoint"
fileMode 0755
}
// ========= sysV init =========
configurationFile '/etc/init.d/elasticsearch'
configurationFile '/etc/init.d/opensearch'
into('/etc/init.d') {
fileMode 0750
fileType CONFIG | NOREPLACE
from "${packagingFiles}/init.d/elasticsearch"
from "${packagingFiles}/init.d/opensearch"
}
// ========= empty dirs =========
@ -265,11 +265,11 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
dirMode mode
}
}
copyEmptyDir('/var/log/elasticsearch', 'elasticsearch', 'elasticsearch', 02750)
copyEmptyDir('/var/lib/elasticsearch', 'elasticsearch', 'elasticsearch', 02750)
copyEmptyDir('/usr/share/elasticsearch/plugins', 'root', 'root', 0755)
copyEmptyDir('/var/log/opensearch', 'opensearch', 'opensearch', 02750)
copyEmptyDir('/var/lib/opensearch', 'opensearch', 'opensearch', 02750)
copyEmptyDir('/usr/share/opensearch/plugins', 'root', 'root', 0755)
into '/usr/share/elasticsearch'
into '/usr/share/opensearch'
with noticeFile(jdk)
}
}
@ -305,7 +305,7 @@ ospackage {
user 'root'
permissionGroup 'root'
into '/usr/share/elasticsearch'
into '/usr/share/opensearch'
}
Closure commonDebConfig(boolean jdk, String architecture) {
@ -326,8 +326,8 @@ Closure commonDebConfig(boolean jdk, String architecture) {
requires 'adduser'
into('/usr/share/lintian/overrides') {
from('src/deb/lintian/elasticsearch')
rename('elasticsearch', 'elasticsearch-oss')
from('src/deb/lintian/opensearch')
rename('opensearch', 'opensearch-oss')
}
}
}
@ -356,15 +356,15 @@ Closure commonRpmConfig(boolean jdk, String architecture) {
obsoletes packageName, '7.0.0', Flags.LESS
prefix '/usr'
packager 'Elasticsearch'
packager 'OpenSearch'
archiveVersion = project.version.replace('-', '_')
release = '1'
os 'LINUX'
distribution 'Elasticsearch'
vendor 'Elasticsearch'
distribution 'OpenSearch'
vendor 'OpenSearch'
// TODO ospackage doesn't support icon but we used to have one
// without this the rpm will have parent dirs of any files we copy in, eg /etc/elasticsearch
// without this the rpm will have parent dirs of any files we copy in, eg /etc/opensearch
addParentDirs false
}
}
@ -455,7 +455,7 @@ subprojects {
Path copyrightPath
String expectedLicense
String licenseFilename
copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/elasticsearch-oss/copyright")
copyrightPath = packageExtractionDir.toPath().resolve("usr/share/doc/opensearch-oss/copyright")
expectedLicense = "ASL-2.0"
licenseFilename = "APACHE-LICENSE-2.0.txt"
final List<String> header = Arrays.asList("Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/",
@ -473,7 +473,7 @@ subprojects {
doLast {
String licenseFilename = "APACHE-LICENSE-2.0.txt"
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/LICENSE.txt")
final Path licensePath = packageExtractionDir.toPath().resolve("usr/share/opensearch/LICENSE.txt")
assertLinesInFile(licensePath, licenseLines)
}
}
@ -486,7 +486,7 @@ subprojects {
}
doLast {
final List<String> noticeLines = Arrays.asList("OpenSearch", "Copyright 2021 OpenSearch Contributors")
final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/elasticsearch/NOTICE.txt")
final Path noticePath = packageExtractionDir.toPath().resolve("usr/share/opensearch/NOTICE.txt")
assertLinesInFile(noticePath, noticeLines)
}
}

View File

@ -1,34 +1,34 @@
################################
# Elasticsearch
# OpenSearch
################################
# Elasticsearch home directory
#ES_HOME=/usr/share/elasticsearch
# OpenSearch home directory
#OPENSEARCH_HOME=/usr/share/opensearch
# Elasticsearch Java path
# OpenSearch Java path
#JAVA_HOME=
# Elasticsearch configuration directory
# OpenSearch configuration directory
# Note: this setting will be shared with command-line tools
ES_PATH_CONF=${path.conf}
OPENSEARCH_PATH_CONF=${path.conf}
# Elasticsearch PID directory
#PID_DIR=/var/run/elasticsearch
# OpenSearch PID directory
#PID_DIR=/var/run/opensearch
# Additional Java OPTS
#ES_JAVA_OPTS=
#OPENSEARCH_JAVA_OPTS=
# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true
################################
# Elasticsearch service
# OpenSearch service
################################
# SysV init.d
#
# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
ES_STARTUP_SLEEP_TIME=5
# The number of seconds to wait before checking if OpenSearch started successfully as a daemon process
OPENSEARCH_STARTUP_SLEEP_TIME=5
################################
# System properties
@ -36,17 +36,17 @@ ES_STARTUP_SLEEP_TIME=5
# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/elasticsearch.service takes precedence
# /usr/lib/systemd/system/opensearch.service takes precedence
#MAX_OPEN_FILES=65535
# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml.
# in opensearch.yml.
# When using systemd, LimitMEMLOCK must be set in a unit file such as
# /etc/systemd/system/elasticsearch.service.d/override.conf.
# /etc/systemd/system/opensearch.service.d/override.conf.
#MAX_LOCKED_MEMORY=unlimited
# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
# property is set at boot time in /usr/lib/sysctl.d/opensearch.conf
#MAX_MAP_COUNT=262144

View File

@ -13,7 +13,7 @@ if [ -f "${path.env}" ]; then
. "${path.env}"
fi
export ES_PATH_CONF=${ES_PATH_CONF:-${path.conf}}
export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}}
IS_UPGRADE=false
@ -50,69 +50,69 @@ case "$1" in
;;
esac
# to pick up /usr/lib/sysctl.d/elasticsearch.conf
# to pick up /usr/lib/sysctl.d/opensearch.conf
if command -v systemctl > /dev/null; then
systemctl restart systemd-sysctl.service || true
fi
if [ "x$IS_UPGRADE" != "xtrue" ]; then
if command -v systemctl >/dev/null; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd"
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using systemd"
echo " sudo systemctl daemon-reload"
echo " sudo systemctl enable elasticsearch.service"
echo "### You can start elasticsearch service by executing"
echo " sudo systemctl start elasticsearch.service"
echo " sudo systemctl enable opensearch.service"
echo "### You can start opensearch service by executing"
echo " sudo systemctl start opensearch.service"
elif command -v chkconfig >/dev/null; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using chkconfig"
echo " sudo chkconfig --add elasticsearch"
echo "### You can start elasticsearch service by executing"
echo " sudo service elasticsearch start"
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using chkconfig"
echo " sudo chkconfig --add opensearch"
echo "### You can start opensearch service by executing"
echo " sudo service opensearch start"
elif command -v update-rc.d >/dev/null; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using chkconfig"
echo " sudo update-rc.d elasticsearch defaults 95 10"
echo "### You can start elasticsearch service by executing"
echo " sudo /etc/init.d/elasticsearch start"
echo "### NOT starting on installation, please execute the following statements to configure opensearch service to start automatically using chkconfig"
echo " sudo update-rc.d opensearch defaults 95 10"
echo "### You can start opensearch service by executing"
echo " sudo /etc/init.d/opensearch start"
fi
elif [ "$RESTART_ON_UPGRADE" = "true" ]; then
echo -n "Restarting elasticsearch service..."
echo -n "Restarting opensearch service..."
if command -v systemctl >/dev/null; then
systemctl daemon-reload
systemctl restart elasticsearch.service || true
systemctl restart opensearch.service || true
elif [ -x /etc/init.d/elasticsearch ]; then
elif [ -x /etc/init.d/opensearch ]; then
if command -v invoke-rc.d >/dev/null; then
invoke-rc.d elasticsearch stop || true
invoke-rc.d elasticsearch start || true
invoke-rc.d opensearch stop || true
invoke-rc.d opensearch start || true
else
/etc/init.d/elasticsearch restart || true
/etc/init.d/opensearch restart || true
fi
# older suse linux distributions do not ship with systemd
# but do not have an /etc/init.d/ directory
# this tries to start the elasticsearch service on these
# this tries to start the opensearch service on these
# as well without failing this script
elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
/etc/rc.d/init.d/elasticsearch restart || true
elif [ -x /etc/rc.d/init.d/opensearch ] ; then
/etc/rc.d/init.d/opensearch restart || true
fi
echo " OK"
fi
# the equivalent code for rpm is in posttrans
if [ "$PACKAGE" = "deb" ]; then
if [ ! -f "${ES_PATH_CONF}"/elasticsearch.keystore ]; then
/usr/share/elasticsearch/bin/elasticsearch-keystore create
chown root:elasticsearch "${ES_PATH_CONF}"/elasticsearch.keystore
chmod 660 "${ES_PATH_CONF}"/elasticsearch.keystore
md5sum "${ES_PATH_CONF}"/elasticsearch.keystore > "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum
if [ ! -f "${OPENSEARCH_PATH_CONF}"/opensearch.keystore ]; then
/usr/share/opensearch/bin/opensearch-keystore create
chown root:opensearch "${OPENSEARCH_PATH_CONF}"/opensearch.keystore
chmod 660 "${OPENSEARCH_PATH_CONF}"/opensearch.keystore
md5sum "${OPENSEARCH_PATH_CONF}"/opensearch.keystore > "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum
else
if /usr/share/elasticsearch/bin/elasticsearch-keystore has-passwd --silent ; then
if /usr/share/opensearch/bin/opensearch-keystore has-passwd --silent ; then
echo "### Warning: unable to upgrade encrypted keystore" 1>&2
echo " Please run elasticsearch-keystore upgrade and enter password" 1>&2
echo " Please run opensearch-keystore upgrade and enter password" 1>&2
else
/usr/share/elasticsearch/bin/elasticsearch-keystore upgrade
/usr/share/opensearch/bin/opensearch-keystore upgrade
fi
fi
fi

View File

@ -14,7 +14,7 @@ if [ -f "${path.env}" ]; then
. "${path.env}"
fi
export ES_PATH_CONF=${ES_PATH_CONF:-${path.conf}}
export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}}
REMOVE_DIRS=false
REMOVE_JVM_OPTIONS_DIRECTORY=false
@ -53,64 +53,64 @@ esac
if [ "$REMOVE_DIRS" = "true" ]; then
if [ -d /var/log/elasticsearch ]; then
if [ -d /var/log/opensearch ]; then
echo -n "Deleting log directory..."
rm -rf /var/log/elasticsearch
rm -rf /var/log/opensearch
echo " OK"
fi
if [ -d /usr/share/elasticsearch/plugins ]; then
if [ -d /usr/share/opensearch/plugins ]; then
echo -n "Deleting plugins directory..."
rm -rf /usr/share/elasticsearch/plugins
rm -rf /usr/share/opensearch/plugins
echo " OK"
fi
# plugins may have contained bin files
if [ -d /usr/share/elasticsearch/bin ]; then
if [ -d /usr/share/opensearch/bin ]; then
echo -n "Deleting plugin bin directories..."
rm -rf /usr/share/elasticsearch/bin
rm -rf /usr/share/opensearch/bin
echo " OK"
fi
if [ -d /var/run/elasticsearch ]; then
if [ -d /var/run/opensearch ]; then
echo -n "Deleting PID directory..."
rm -rf /var/run/elasticsearch
rm -rf /var/run/opensearch
echo " OK"
fi
# Delete the data directory if and only if empty
if [ -d /var/lib/elasticsearch ]; then
rmdir --ignore-fail-on-non-empty /var/lib/elasticsearch
if [ -d /var/lib/opensearch ]; then
rmdir --ignore-fail-on-non-empty /var/lib/opensearch
fi
# delete the jvm.options.d directory if and only if empty
if [ -d "${ES_PATH_CONF}/jvm.options.d" ]; then
rmdir --ignore-fail-on-non-empty "${ES_PATH_CONF}/jvm.options.d"
if [ -d "${OPENSEARCH_PATH_CONF}/jvm.options.d" ]; then
rmdir --ignore-fail-on-non-empty "${OPENSEARCH_PATH_CONF}/jvm.options.d"
fi
# delete the jvm.options.d directory if we are purging
if [ "$REMOVE_JVM_OPTIONS_DIRECTORY" = "true" ]; then
if [ -d "${ES_PATH_CONF}/jvm.options.d" ]; then
if [ -d "${OPENSEARCH_PATH_CONF}/jvm.options.d" ]; then
echo -n "Deleting jvm.options.d directory..."
rm -rf "${ES_PATH_CONF}/jvm.options.d"
rm -rf "${OPENSEARCH_PATH_CONF}/jvm.options.d"
echo " OK"
fi
fi
# delete the conf directory if and only if empty
if [ -d "${ES_PATH_CONF}" ]; then
rmdir --ignore-fail-on-non-empty "${ES_PATH_CONF}"
if [ -d "${OPENSEARCH_PATH_CONF}" ]; then
rmdir --ignore-fail-on-non-empty "${OPENSEARCH_PATH_CONF}"
fi
fi
if [ "$REMOVE_USER_AND_GROUP" = "true" ]; then
if id elasticsearch > /dev/null 2>&1 ; then
userdel elasticsearch
if id opensearch > /dev/null 2>&1 ; then
userdel opensearch
fi
if getent group elasticsearch > /dev/null 2>&1 ; then
groupdel elasticsearch
if getent group opensearch > /dev/null 2>&1 ; then
groupdel opensearch
fi
fi

View File

@ -3,19 +3,19 @@ if [ -f "${path.env}" ]; then
. "${path.env}"
fi
export ES_PATH_CONF=${ES_PATH_CONF:-${path.conf}}
export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}}
if [ ! -f "${ES_PATH_CONF}"/elasticsearch.keystore ]; then
/usr/share/elasticsearch/bin/elasticsearch-keystore create
chown root:elasticsearch "${ES_PATH_CONF}"/elasticsearch.keystore
chmod 660 "${ES_PATH_CONF}"/elasticsearch.keystore
md5sum "${ES_PATH_CONF}"/elasticsearch.keystore > "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum
if [ ! -f "${OPENSEARCH_PATH_CONF}"/opensearch.keystore ]; then
/usr/share/opensearch/bin/opensearch-keystore create
chown root:opensearch "${OPENSEARCH_PATH_CONF}"/opensearch.keystore
chmod 660 "${OPENSEARCH_PATH_CONF}"/opensearch.keystore
md5sum "${OPENSEARCH_PATH_CONF}"/opensearch.keystore > "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum
else
if /usr/share/elasticsearch/bin/elasticsearch-keystore has-passwd --silent ; then
if /usr/share/opensearch/bin/opensearch-keystore has-passwd --silent ; then
echo "### Warning: unable to upgrade encrypted keystore" 1>&2
echo " Please run elasticsearch-keystore upgrade and enter password" 1>&2
echo " Please run opensearch-keystore upgrade and enter password" 1>&2
else
/usr/share/elasticsearch/bin/elasticsearch-keystore upgrade
/usr/share/opensearch/bin/opensearch-keystore upgrade
fi
fi

View File

@ -20,31 +20,31 @@ if [ -f "${path.env}" ]; then
. "${path.env}"
fi
export ES_PATH_CONF=${ES_PATH_CONF:-${path.conf}}
export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}}
case "$1" in
# Debian ####################################################
install|upgrade)
# Create elasticsearch group if not existing
if ! getent group elasticsearch > /dev/null 2>&1 ; then
echo -n "Creating elasticsearch group..."
addgroup --quiet --system elasticsearch
# Create opensearch group if not existing
if ! getent group opensearch > /dev/null 2>&1 ; then
echo -n "Creating opensearch group..."
addgroup --quiet --system opensearch
echo " OK"
fi
# Create elasticsearch user if not existing
if ! id elasticsearch > /dev/null 2>&1 ; then
echo -n "Creating elasticsearch user..."
# Create opensearch user if not existing
if ! id opensearch > /dev/null 2>&1 ; then
echo -n "Creating opensearch user..."
adduser --quiet \
--system \
--no-create-home \
--home /nonexistent \
--ingroup elasticsearch \
--ingroup opensearch \
--disabled-password \
--shell /bin/false \
elasticsearch
opensearch
echo " OK"
fi
;;
@ -54,23 +54,23 @@ case "$1" in
# RedHat ####################################################
1|2)
# Create elasticsearch group if not existing
if ! getent group elasticsearch > /dev/null 2>&1 ; then
echo -n "Creating elasticsearch group..."
groupadd -r elasticsearch
# Create opensearch group if not existing
if ! getent group opensearch > /dev/null 2>&1 ; then
echo -n "Creating opensearch group..."
groupadd -r opensearch
echo " OK"
fi
# Create elasticsearch user if not existing
if ! id elasticsearch > /dev/null 2>&1 ; then
echo -n "Creating elasticsearch user..."
# Create opensearch user if not existing
if ! id opensearch > /dev/null 2>&1 ; then
echo -n "Creating opensearch user..."
useradd --system \
--no-create-home \
--home-dir /nonexistent \
--gid elasticsearch \
--gid opensearch \
--shell /sbin/nologin \
--comment "elasticsearch user" \
elasticsearch
--comment "opensearch user" \
opensearch
echo " OK"
fi
;;

View File

@ -14,7 +14,7 @@ if [ -f "${path.env}" ]; then
. "${path.env}"
fi
export ES_PATH_CONF=${ES_PATH_CONF:-${path.conf}}
export OPENSEARCH_PATH_CONF=${OPENSEARCH_PATH_CONF:-${path.conf}}
STOP_REQUIRED=false
REMOVE_SERVICE=false
@ -51,44 +51,44 @@ esac
# Stops the service
if [ "$STOP_REQUIRED" = "true" ]; then
echo -n "Stopping elasticsearch service..."
echo -n "Stopping opensearch service..."
if command -v systemctl >/dev/null; then
systemctl --no-reload stop elasticsearch.service
systemctl --no-reload stop opensearch.service
elif [ -x /etc/init.d/elasticsearch ]; then
elif [ -x /etc/init.d/opensearch ]; then
if command -v invoke-rc.d >/dev/null; then
invoke-rc.d elasticsearch stop
invoke-rc.d opensearch stop
else
/etc/init.d/elasticsearch stop
/etc/init.d/opensearch stop
fi
# older suse linux distributions do not ship with systemd
# but do not have an /etc/init.d/ directory
# this tries to start the elasticsearch service on these
# this tries to start the opensearch service on these
# as well without failing this script
elif [ -x /etc/rc.d/init.d/elasticsearch ] ; then
/etc/rc.d/init.d/elasticsearch stop
elif [ -x /etc/rc.d/init.d/opensearch ] ; then
/etc/rc.d/init.d/opensearch stop
fi
echo " OK"
fi
if [ -f "${ES_PATH_CONF}"/elasticsearch.keystore ]; then
if md5sum --status -c "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum; then
rm "${ES_PATH_CONF}"/elasticsearch.keystore "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum
if [ -f "${OPENSEARCH_PATH_CONF}"/opensearch.keystore ]; then
if md5sum --status -c "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum; then
rm "${OPENSEARCH_PATH_CONF}"/opensearch.keystore "${OPENSEARCH_PATH_CONF}"/.opensearch.keystore.initial_md5sum
fi
fi
if [ "$REMOVE_SERVICE" = "true" ]; then
if command -v systemctl >/dev/null; then
systemctl disable elasticsearch.service > /dev/null 2>&1 || true
systemctl disable opensearch.service > /dev/null 2>&1 || true
fi
if command -v chkconfig >/dev/null; then
chkconfig --del elasticsearch 2> /dev/null || true
chkconfig --del opensearch 2> /dev/null || true
fi
if command -v update-rc.d >/dev/null; then
update-rc.d elasticsearch remove >/dev/null || true
update-rc.d opensearch remove >/dev/null || true
fi
fi

View File

@ -1 +1 @@
d /var/run/elasticsearch 0755 elasticsearch elasticsearch - -
d /var/run/opensearch 0755 opensearch opensearch - -

View File

@ -1,30 +1,30 @@
[Unit]
Description=Elasticsearch
Description=OpenSearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Type=notify
RuntimeDirectory=elasticsearch
RuntimeDirectory=opensearch
PrivateTmp=true
Environment=ES_HOME=/usr/share/elasticsearch
Environment=ES_PATH_CONF=${path.conf}
Environment=PID_DIR=/var/run/elasticsearch
Environment=ES_SD_NOTIFY=true
Environment=OPENSEARCH_HOME=/usr/share/opensearch
Environment=OPENSEARCH_PATH_CONF=${path.conf}
Environment=PID_DIR=/var/run/opensearch
Environment=OPENSEARCH_SD_NOTIFY=true
EnvironmentFile=-${path.env}
WorkingDirectory=/usr/share/elasticsearch
WorkingDirectory=/usr/share/opensearch
User=elasticsearch
Group=elasticsearch
User=opensearch
Group=opensearch
ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet
ExecStart=/usr/share/opensearch/bin/systemd-entrypoint -p ${PID_DIR}/opensearch.pid --quiet
# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# opensearch logging system is initialized. OpenSearch
# stores its logs in /var/log/opensearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal

View File

@ -1,10 +1,10 @@
#!/bin/sh
# This wrapper script allows SystemD to feed a file containing a passphrase into
# the main Elasticsearch startup script
# the main OpenSearch startup script
if [ -n "$ES_KEYSTORE_PASSPHRASE_FILE" ] ; then
exec /usr/share/elasticsearch/bin/elasticsearch "$@" < "$ES_KEYSTORE_PASSPHRASE_FILE"
if [ -n "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE" ] ; then
exec /usr/share/opensearch/bin/opensearch "$@" < "$OPENSEARCH_KEYSTORE_PASSPHRASE_FILE"
else
exec /usr/share/elasticsearch/bin/elasticsearch "$@"
exec /usr/share/opensearch/bin/opensearch "$@"
fi

View File

@ -1,20 +1,20 @@
#!/bin/bash
#
# /etc/init.d/elasticsearch -- startup script for Elasticsearch
# /etc/init.d/opensearch -- startup script for OpenSearch
#
### BEGIN INIT INFO
# Provides: elasticsearch
# Provides: opensearch
# Required-Start: $network $remote_fs $named
# Required-Stop: $network $remote_fs $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts elasticsearch
# Description: Starts elasticsearch using start-stop-daemon
# Short-Description: Starts opensearch
# Description: Starts opensearch using start-stop-daemon
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=elasticsearch
DESC="Elasticsearch Server"
NAME=opensearch
DESC="OpenSearch Server"
DEFAULT=/etc/default/$NAME
if [ `id -u` -ne 0 ]; then
@ -32,11 +32,11 @@ fi
# The following variables can be overwritten in $DEFAULT
# Directory where the Elasticsearch binary distribution resides
ES_HOME=/usr/share/$NAME
# Directory where the OpenSearch binary distribution resides
OPENSEARCH_HOME=/usr/share/$NAME
# Additional Java OPTS
#ES_JAVA_OPTS=
#OPENSEARCH_JAVA_OPTS=
# Maximum number of open files
MAX_OPEN_FILES=65535
@ -44,14 +44,14 @@ MAX_OPEN_FILES=65535
# Maximum amount of locked memory
#MAX_LOCKED_MEMORY=
# Elasticsearch configuration directory
ES_PATH_CONF=/etc/$NAME
# OpenSearch configuration directory
OPENSEARCH_PATH_CONF=/etc/$NAME
# Maximum number of VMA (Virtual Memory Areas) a process can own
MAX_MAP_COUNT=262144
# Elasticsearch PID file directory
PID_DIR="/var/run/elasticsearch"
# OpenSearch PID file directory
PID_DIR="/var/run/opensearch"
# End of variables that can be overwritten in $DEFAULT
@ -68,15 +68,15 @@ fi
# Define other required variables
PID_FILE="$PID_DIR/$NAME.pid"
DAEMON=$ES_HOME/bin/elasticsearch
DAEMON=$OPENSEARCH_HOME/bin/opensearch
DAEMON_OPTS="-d -p $PID_FILE"
export ES_JAVA_OPTS
export OPENSEARCH_JAVA_OPTS
export JAVA_HOME
export ES_PATH_CONF
export OPENSEARCH_PATH_CONF
if [ ! -x "$DAEMON" ]; then
echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON"
echo "The opensearch startup script does not exists or it is not executable, tried: $DAEMON"
exit 1
fi
@ -85,7 +85,7 @@ case "$1" in
log_daemon_msg "Starting $DESC"
pid=`pidofproc -p $PID_FILE elasticsearch`
pid=`pidofproc -p $PID_FILE opensearch`
if [ -n "$pid" ] ; then
log_begin_msg "Already running."
log_end_msg 0
@ -94,10 +94,10 @@ case "$1" in
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
mkdir -p "$PID_DIR" && chown opensearch:opensearch "$PID_DIR"
fi
if [ -n "$PID_FILE" ] && [ ! -e "$PID_FILE" ]; then
touch "$PID_FILE" && chown elasticsearch:elasticsearch "$PID_FILE"
touch "$PID_FILE" && chown opensearch:opensearch "$PID_FILE"
fi
if [ -n "$MAX_OPEN_FILES" ]; then
@ -113,7 +113,7 @@ case "$1" in
fi
# Start Daemon
start-stop-daemon -d $ES_HOME --start --user elasticsearch -c elasticsearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
start-stop-daemon -d $OPENSEARCH_HOME --start --user opensearch -c opensearch --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS
return=$?
if [ $return -eq 0 ]; then
i=0
@ -137,7 +137,7 @@ case "$1" in
if [ -f "$PID_FILE" ]; then
start-stop-daemon --stop --pidfile "$PID_FILE" \
--user elasticsearch \
--user opensearch \
--quiet \
--retry forever/TERM/20 > /dev/null
if [ $? -eq 1 ]; then
@ -154,7 +154,7 @@ case "$1" in
log_end_msg 0
;;
status)
status_of_proc -p $PID_FILE elasticsearch elasticsearch && exit 0 || exit $?
status_of_proc -p $PID_FILE opensearch opensearch && exit 0 || exit $?
;;
restart|force-reload)
if [ -f "$PID_FILE" ]; then

View File

@ -1,5 +1,5 @@
# we don't have a changelog, but we put our copyright file
# under /usr/share/doc/elasticsearch, which triggers this warning
# under /usr/share/doc/opensearch, which triggers this warning
changelog-file-missing-in-native-package
# we intentionally copy our copyright file for all deb packages
@ -7,43 +7,43 @@ copyright-file-contains-full-apache-2-license
copyright-should-refer-to-common-license-file-for-apache-2
copyright-without-copyright-notice
# we still put all our files under /usr/share/elasticsearch even after transition to platform dependent packages
# we still put all our files under /usr/share/opensearch even after transition to platform dependent packages
arch-dependent-file-in-usr-share
# we have a bundled jdk, so don't use jarwrapper
missing-dep-on-jarwrapper
# we prefer to not make our config and log files world readable
non-standard-file-perm etc/default/elasticsearch 0660 != 0644
non-standard-dir-perm etc/elasticsearch/ 2750 != 0755
non-standard-dir-perm etc/elasticsearch/jvm.options.d/ 2750 != 0755
non-standard-file-perm etc/elasticsearch/*
non-standard-dir-perm var/lib/elasticsearch/ 2750 != 0755
non-standard-dir-perm var/log/elasticsearch/ 2750 != 0755
executable-is-not-world-readable etc/init.d/elasticsearch 0750
non-standard-file-permissions-for-etc-init.d-script etc/init.d/elasticsearch 0750 != 0755
non-standard-file-perm etc/default/opensearch 0660 != 0644
non-standard-dir-perm etc/opensearch/ 2750 != 0755
non-standard-dir-perm etc/opensearch/jvm.options.d/ 2750 != 0755
non-standard-file-perm etc/opensearch/*
non-standard-dir-perm var/lib/opensearch/ 2750 != 0755
non-standard-dir-perm var/log/opensearch/ 2750 != 0755
executable-is-not-world-readable etc/init.d/opensearch 0750
non-standard-file-permissions-for-etc-init.d-script etc/init.d/opensearch 0750 != 0755
# this lintian tag is simply wrong; contrary to the explanation, debian systemd
# does actually look at /usr/lib/systemd/system
systemd-service-file-outside-lib usr/lib/systemd/system/elasticsearch.service
systemd-service-file-outside-lib usr/lib/systemd/system/opensearch.service
# we do not automatically enable the service in init.d or systemd
script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/elasticsearch
script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/opensearch
# the package scripts handle init.d/systemd directly and don't need to use deb helpers
maintainer-script-calls-systemctl
prerm-calls-updaterc.d elasticsearch
prerm-calls-updaterc.d opensearch
# bundled JDK
embedded-library
arch-dependent-file-in-usr-share usr/share/elasticsearch/jdk/*
unstripped-binary-or-object usr/share/elasticsearch/jdk/*
extra-license-file usr/share/elasticsearch/jdk/legal/*
hardening-no-pie usr/share/elasticsearch/jdk/bin/*
hardening-no-pie usr/share/elasticsearch/jdk/lib/*
arch-dependent-file-in-usr-share usr/share/opensearch/jdk/*
unstripped-binary-or-object usr/share/opensearch/jdk/*
extra-license-file usr/share/opensearch/jdk/legal/*
hardening-no-pie usr/share/opensearch/jdk/bin/*
hardening-no-pie usr/share/opensearch/jdk/lib/*
# the system java version that lintian assumes is far behind what elasticsearch uses
# the system java version that lintian assumes is far behind what opensearch uses
unknown-java-class-version
# elastic licensed modules contain elastic license
extra-license-file usr/share/elasticsearch/modules/*
extra-license-file usr/share/opensearch/modules/*

View File

@ -1,19 +1,19 @@
#!/bin/bash
#
# elasticsearch <summary>
# opensearch <summary>
#
# chkconfig: 2345 80 20
# description: Starts and stops a single elasticsearch instance on this system
# description: Starts and stops a single opensearch instance on this system
#
### BEGIN INIT INFO
# Provides: Elasticsearch
# Provides: OpenSearch
# Required-Start: $network $named
# Required-Stop: $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This service manages the elasticsearch daemon
# Description: Elasticsearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
# Short-Description: This service manages the opensearch daemon
# Description: OpenSearch is a very scalable, schema-free and high-performance search solution supporting multi-tenancy and near realtime search.
### END INIT INFO
#
@ -31,18 +31,18 @@ if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
# Sets the default values for elasticsearch variables used in this script
ES_HOME="/usr/share/elasticsearch"
# Sets the default values for opensearch variables used in this script
OPENSEARCH_HOME="/usr/share/opensearch"
MAX_OPEN_FILES=65535
MAX_MAP_COUNT=262144
ES_PATH_CONF="${path.conf}"
OPENSEARCH_PATH_CONF="${path.conf}"
PID_DIR="/var/run/elasticsearch"
PID_DIR="/var/run/opensearch"
# Source the default env file
ES_ENV_FILE="${path.env}"
if [ -f "$ES_ENV_FILE" ]; then
. "$ES_ENV_FILE"
OPENSEARCH_ENV_FILE="${path.env}"
if [ -f "$OPENSEARCH_ENV_FILE" ]; then
. "$OPENSEARCH_ENV_FILE"
fi
# ES_USER and ES_GROUP settings were removed
@ -51,19 +51,19 @@ if [ ! -z "$ES_USER" ] || [ ! -z "$ES_GROUP" ]; then
exit 1
fi
exec="$ES_HOME/bin/elasticsearch"
prog="elasticsearch"
exec="$OPENSEARCH_HOME/bin/opensearch"
prog="opensearch"
pidfile="$PID_DIR/${prog}.pid"
export ES_JAVA_OPTS
export OPENSEARCH_JAVA_OPTS
export JAVA_HOME
export ES_PATH_CONF
export ES_STARTUP_SLEEP_TIME
export OPENSEARCH_PATH_CONF
export OPENSEARCH_STARTUP_SLEEP_TIME
lockfile=/var/lock/subsys/$prog
if [ ! -x "$exec" ]; then
echo "The elasticsearch startup script does not exists or it is not executable, tried: $exec"
echo "The opensearch startup script does not exists or it is not executable, tried: $exec"
exit 1
fi
@ -82,16 +82,16 @@ start() {
# Ensure that the PID_DIR exists (it is cleaned at OS startup time)
if [ -n "$PID_DIR" ] && [ ! -e "$PID_DIR" ]; then
mkdir -p "$PID_DIR" && chown elasticsearch:elasticsearch "$PID_DIR"
mkdir -p "$PID_DIR" && chown opensearch:opensearch "$PID_DIR"
fi
if [ -n "$pidfile" ] && [ ! -e "$pidfile" ]; then
touch "$pidfile" && chown elasticsearch:elasticsearch "$pidfile"
touch "$pidfile" && chown opensearch:opensearch "$pidfile"
fi
cd $ES_HOME
cd $OPENSEARCH_HOME
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
daemon --user elasticsearch --pidfile $pidfile $exec -p $pidfile -d
daemon --user opensearch --pidfile $pidfile $exec -p $pidfile -d
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile

View File

@ -5,15 +5,15 @@
# This script relies on a few environment variables to determine startup
# behavior, those variables are:
#
# ES_PATH_CONF -- Path to config directory
# ES_JAVA_OPTS -- External Java Opts on top of the defaults set
# OPENSEARCH_PATH_CONF -- Path to config directory
# OPENSEARCH_JAVA_OPTS -- External Java Opts on top of the defaults set
#
# Optionally, exact memory values can be set using the `ES_JAVA_OPTS`. Example
# Optionally, exact memory values can be set using the `OPENSEARCH_JAVA_OPTS`. Example
# values are "512m", and "10g".
#
# ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch
# OPENSEARCH_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/opensearch
source "`dirname "$0"`"/elasticsearch-env
source "`dirname "$0"`"/opensearch-env
CHECK_KEYSTORE=true
DAEMONIZE=false
@ -28,8 +28,8 @@ for option in "$@"; do
esac
done
if [ -z "$ES_TMPDIR" ]; then
ES_TMPDIR=`"$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.TempDirectory`
if [ -z "$OPENSEARCH_TMPDIR" ]; then
OPENSEARCH_TMPDIR=`"$JAVA" "$XSHARE" -cp "$OPENSEARCH_CLASSPATH" org.opensearch.tools.launchers.TempDirectory`
fi
# get keystore password before setting java options to avoid
@ -37,54 +37,54 @@ fi
unset KEYSTORE_PASSWORD
KEYSTORE_PASSWORD=
if [[ $CHECK_KEYSTORE = true ]] \
&& bin/elasticsearch-keystore has-passwd --silent
&& bin/opensearch-keystore has-passwd --silent
then
if ! read -s -r -p "Elasticsearch keystore password: " KEYSTORE_PASSWORD ; then
if ! read -s -r -p "OpenSearch keystore password: " KEYSTORE_PASSWORD ; then
echo "Failed to read keystore password on console" 1>&2
exit 1
fi
fi
# The JVM options parser produces the final JVM options to start Elasticsearch.
# The JVM options parser produces the final JVM options to start OpenSearch.
# It does this by incorporating JVM options in the following way:
# - first, system JVM options are applied (these are hardcoded options in the
# parser)
# - second, JVM options are read from jvm.options and jvm.options.d/*.options
# - third, JVM options from ES_JAVA_OPTS are applied
# - third, JVM options from OPENSEARCH_JAVA_OPTS are applied
# - fourth, ergonomic JVM options are applied
ES_JAVA_OPTS=`export ES_TMPDIR; "$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.JvmOptionsParser "$ES_PATH_CONF"`
OPENSEARCH_JAVA_OPTS=`export OPENSEARCH_TMPDIR; "$JAVA" "$XSHARE" -cp "$OPENSEARCH_CLASSPATH" org.opensearch.tools.launchers.JvmOptionsParser "$OPENSEARCH_PATH_CONF"`
# manual parsing to find out, if process should be detached
if [[ $DAEMONIZE = false ]]; then
exec \
"$JAVA" \
"$XSHARE" \
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-Des.bundled_jdk="$ES_BUNDLED_JDK" \
-cp "$ES_CLASSPATH" \
org.elasticsearch.bootstrap.Elasticsearch \
$OPENSEARCH_JAVA_OPTS \
-Des.path.home="$OPENSEARCH_HOME" \
-Des.path.conf="$OPENSEARCH_PATH_CONF" \
-Des.distribution.type="$OPENSEARCH_DISTRIBUTION_TYPE" \
-Des.bundled_jdk="$OPENSEARCH_BUNDLED_JDK" \
-cp "$OPENSEARCH_CLASSPATH" \
org.opensearch.bootstrap.OpenSearch \
"$@" <<<"$KEYSTORE_PASSWORD"
else
exec \
"$JAVA" \
"$XSHARE" \
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-Des.bundled_jdk="$ES_BUNDLED_JDK" \
-cp "$ES_CLASSPATH" \
org.elasticsearch.bootstrap.Elasticsearch \
$OPENSEARCH_JAVA_OPTS \
-Des.path.home="$OPENSEARCH_HOME" \
-Des.path.conf="$OPENSEARCH_PATH_CONF" \
-Des.distribution.type="$OPENSEARCH_DISTRIBUTION_TYPE" \
-Des.bundled_jdk="$OPENSEARCH_BUNDLED_JDK" \
-cp "$OPENSEARCH_CLASSPATH" \
org.opensearch.bootstrap.OpenSearch \
"$@" \
<<<"$KEYSTORE_PASSWORD" &
retval=$?
pid=$!
[ $retval -eq 0 ] || exit $retval
if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
sleep $ES_STARTUP_SLEEP_TIME
if [ ! -z "$OPENSEARCH_STARTUP_SLEEP_TIME" ]; then
sleep $OPENSEARCH_STARTUP_SLEEP_TIME
fi
if ! ps -p $pid > /dev/null ; then
exit 1

View File

@ -2,31 +2,31 @@
set -e -o pipefail
source "`dirname "$0"`"/elasticsearch-env
source "`dirname "$0"`"/opensearch-env
IFS=';' read -r -a additional_sources <<< "$ES_ADDITIONAL_SOURCES"
IFS=';' read -r -a additional_sources <<< "$OPENSEARCH_ADDITIONAL_SOURCES"
for additional_source in "${additional_sources[@]}"
do
source "$ES_HOME"/bin/$additional_source
source "$OPENSEARCH_HOME"/bin/$additional_source
done
IFS=';' read -r -a additional_classpath_directories <<< "$ES_ADDITIONAL_CLASSPATH_DIRECTORIES"
IFS=';' read -r -a additional_classpath_directories <<< "$OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES"
for additional_classpath_directory in "${additional_classpath_directories[@]}"
do
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/$additional_classpath_directory/*"
OPENSEARCH_CLASSPATH="$OPENSEARCH_CLASSPATH:$OPENSEARCH_HOME/$additional_classpath_directory/*"
done
# use a small heap size for the CLI tools, and thus the serial collector to
# avoid stealing many CPU cycles; a user can override by setting ES_JAVA_OPTS
ES_JAVA_OPTS="-Xms4m -Xmx64m -XX:+UseSerialGC ${ES_JAVA_OPTS}"
# avoid stealing many CPU cycles; a user can override by setting OPENSEARCH_JAVA_OPTS
OPENSEARCH_JAVA_OPTS="-Xms4m -Xmx64m -XX:+UseSerialGC ${OPENSEARCH_JAVA_OPTS}"
exec \
"$JAVA" \
"$XSHARE" \
$ES_JAVA_OPTS \
-Des.path.home="$ES_HOME" \
-Des.path.conf="$ES_PATH_CONF" \
-Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
-cp "$ES_CLASSPATH" \
"$ES_MAIN_CLASS" \
$OPENSEARCH_JAVA_OPTS \
-Des.path.home="$OPENSEARCH_HOME" \
-Des.path.conf="$OPENSEARCH_PATH_CONF" \
-Des.distribution.type="$OPENSEARCH_DISTRIBUTION_TYPE" \
-cp "$OPENSEARCH_CLASSPATH" \
"$OPENSEARCH_MAIN_CLASS" \
"$@"

View File

@ -1,28 +1,28 @@
call "%~dp0elasticsearch-env.bat" || exit /b 1
call "%~dp0opensearch-env.bat" || exit /b 1
if defined ES_ADDITIONAL_SOURCES (
for %%a in ("%ES_ADDITIONAL_SOURCES:;=","%") do (
if defined OPENSEARCH_ADDITIONAL_SOURCES (
for %%a in ("%OPENSEARCH_ADDITIONAL_SOURCES:;=","%") do (
call "%~dp0%%a"
)
)
if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
for %%a in ("%ES_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do (
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/%%a/*
if defined OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES (
for %%a in ("%OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do (
set OPENSEARCH_CLASSPATH=!OPENSEARCH_CLASSPATH!;!OPENSEARCH_HOME!/%%a/*
)
)
rem use a small heap size for the CLI tools, and thus the serial collector to
rem avoid stealing many CPU cycles; a user can override by setting ES_JAVA_OPTS
set ES_JAVA_OPTS=-Xms4m -Xmx64m -XX:+UseSerialGC %ES_JAVA_OPTS%
rem avoid stealing many CPU cycles; a user can override by setting OPENSEARCH_JAVA_OPTS
set OPENSEARCH_JAVA_OPTS=-Xms4m -Xmx64m -XX:+UseSerialGC %OPENSEARCH_JAVA_OPTS%
%JAVA% ^
%ES_JAVA_OPTS% ^
-Des.path.home="%ES_HOME%" ^
-Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-cp "%ES_CLASSPATH%" ^
"%ES_MAIN_CLASS%" ^
%OPENSEARCH_JAVA_OPTS% ^
-Des.path.home="%OPENSEARCH_HOME%" ^
-Des.path.conf="%OPENSEARCH_PATH_CONF%" ^
-Des.distribution.type="%OPENSEARCH_DISTRIBUTION_TYPE%" ^
-cp "%OPENSEARCH_CLASSPATH%" ^
"%OPENSEARCH_MAIN_CLASS%" ^
%*
exit /b %ERRORLEVEL%

View File

@ -19,21 +19,21 @@ while [ -h "$SCRIPT" ] ; do
fi
done
# determine Elasticsearch home; to do this, we strip from the path until we find
# determine OpenSearch home; to do this, we strip from the path until we find
# bin, and then strip bin (there is an assumption here that there is no nested
# directory under bin also named bin)
ES_HOME=`dirname "$SCRIPT"`
OPENSEARCH_HOME=`dirname "$SCRIPT"`
# now make ES_HOME absolute
ES_HOME=`cd "$ES_HOME"; pwd`
# now make OPENSEARCH_HOME absolute
OPENSEARCH_HOME=`cd "$OPENSEARCH_HOME"; pwd`
while [ "`basename "$ES_HOME"`" != "bin" ]; do
ES_HOME=`dirname "$ES_HOME"`
while [ "`basename "$OPENSEARCH_HOME"`" != "bin" ]; do
OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"`
done
ES_HOME=`dirname "$ES_HOME"`
OPENSEARCH_HOME=`dirname "$OPENSEARCH_HOME"`
# now set the classpath
ES_CLASSPATH="$ES_HOME/lib/*"
OPENSEARCH_CLASSPATH="$OPENSEARCH_HOME/lib/*"
# now set the path to java
if [ ! -z "$JAVA_HOME" ]; then
@ -42,9 +42,9 @@ if [ ! -z "$JAVA_HOME" ]; then
else
if [ "$(uname -s)" = "Darwin" ]; then
# macOS has a different structure
JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
JAVA="$OPENSEARCH_HOME/jdk.app/Contents/Home/bin/java"
else
JAVA="$ES_HOME/jdk/bin/java"
JAVA="$OPENSEARCH_HOME/jdk/bin/java"
fi
JAVA_TYPE="bundled jdk"
fi
@ -64,7 +64,7 @@ fi
# warn them that we are not observing the value of $JAVA_OPTS
if [ ! -z "$JAVA_OPTS" ]; then
echo -n "warning: ignoring JAVA_OPTS=$JAVA_OPTS; "
echo "pass JVM parameters via ES_JAVA_OPTS"
echo "pass JVM parameters via OPENSEARCH_JAVA_OPTS"
fi
if [[ "$("$JAVA" -version 2>/dev/null)" =~ "Unable to map CDS archive" ]]; then
@ -74,58 +74,58 @@ else
fi
# check the Java version
"$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
"$JAVA" "$XSHARE" -cp "$OPENSEARCH_CLASSPATH" org.opensearch.tools.java_version_checker.JavaVersionChecker
export HOSTNAME=$HOSTNAME
${source.path.env}
if [ -z "$ES_PATH_CONF" ]; then
echo "ES_PATH_CONF must be set to the configuration path"
if [ -z "$OPENSEARCH_PATH_CONF" ]; then
echo "OPENSEARCH_PATH_CONF must be set to the configuration path"
exit 1
fi
# now make ES_PATH_CONF absolute
ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
# now make OPENSEARCH_PATH_CONF absolute
OPENSEARCH_PATH_CONF=`cd "$OPENSEARCH_PATH_CONF"; pwd`
ES_DISTRIBUTION_TYPE=${es.distribution.type}
ES_BUNDLED_JDK=${es.bundled_jdk}
OPENSEARCH_DISTRIBUTION_TYPE=${opensearch.distribution.type}
OPENSEARCH_BUNDLED_JDK=${opensearch.bundled_jdk}
if [[ "$ES_BUNDLED_JDK" == "false" ]]; then
if [[ "$OPENSEARCH_BUNDLED_JDK" == "false" ]]; then
echo "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" >&2
fi
if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
if [[ "$OPENSEARCH_DISTRIBUTION_TYPE" == "docker" ]]; then
# Allow environment variables to be set by creating a file with the
# contents, and setting an environment variable with the suffix _FILE to
# point to it. This can be used to provide secrets to a container, without
# the values being specified explicitly when running the container.
source "$ES_HOME/bin/elasticsearch-env-from-file"
source "$OPENSEARCH_HOME/bin/opensearch-env-from-file"
# Parse Docker env vars to customize Elasticsearch
# Parse Docker env vars to customize OpenSearch
#
# e.g. Setting the env var cluster.name=testcluster
#
# will cause Elasticsearch to be invoked with -Ecluster.name=testcluster
# will cause OpenSearch to be invoked with -Ecluster.name=testcluster
#
# see https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#_setting_default_settings
declare -a es_arg_array
declare -a opensearch_arg_array
while IFS='=' read -r envvar_key envvar_value
do
# Elasticsearch settings need to have at least two dot separated lowercase
# OpenSearch settings need to have at least two dot separated lowercase
# words, e.g. `cluster.name`
if [[ "$envvar_key" =~ ^[a-z0-9_]+\.[a-z0-9_]+ ]]; then
if [[ ! -z $envvar_value ]]; then
es_opt="-E${envvar_key}=${envvar_value}"
es_arg_array+=("${es_opt}")
opensearch_opt="-E${envvar_key}=${envvar_value}"
opensearch_arg_array+=("${opensearch_opt}")
fi
fi
done < <(env)
# Reset the positional parameters to the es_arg_array values and any existing positional params
set -- "$@" "${es_arg_array[@]}"
# Reset the positional parameters to the opensearch_arg_array values and any existing positional params
set -- "$@" "${opensearch_arg_array[@]}"
# The virtual file /proc/self/cgroup should list the current cgroup
# membership. For each hierarchy, you can follow the cgroup path from
@ -133,13 +133,13 @@ if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
# introspect the statistics for the cgroup for the given
# hierarchy. Alas, Docker breaks this by mounting the container
# statistics at the root while leaving the cgroup paths as the actual
# paths. Therefore, Elasticsearch provides a mechanism to override
# paths. Therefore, OpenSearch provides a mechanism to override
# reading the cgroup path from /proc/self/cgroup and instead uses the
# cgroup path defined the JVM system property
# es.cgroups.hierarchy.override. Therefore, we set this value here so
# opensearch.cgroups.hierarchy.override. Therefore, we set this value here so
# that cgroup statistics are available for the container this process
# will run in.
export ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $ES_JAVA_OPTS"
export OPENSEARCH_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $OPENSEARCH_JAVA_OPTS"
fi
cd "$ES_HOME"
cd "$OPENSEARCH_HOME"

View File

@ -1,38 +1,38 @@
set SCRIPT=%0
rem determine Elasticsearch home; to do this, we strip from the path until we
rem determine OpenSearch home; to do this, we strip from the path until we
rem find bin, and then strip bin (there is an assumption here that there is no
rem nested directory under bin also named bin)
for %%I in (%SCRIPT%) do set ES_HOME=%%~dpI
for %%I in (%SCRIPT%) do set OPENSEARCH_HOME=%%~dpI
:es_home_loop
for %%I in ("%ES_HOME:~1,-1%") do set DIRNAME=%%~nxI
:opensearch_home_loop
for %%I in ("%OPENSEARCH_HOME:~1,-1%") do set DIRNAME=%%~nxI
if not "%DIRNAME%" == "bin" (
for %%I in ("%ES_HOME%..") do set ES_HOME=%%~dpfI
goto es_home_loop
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
goto opensearch_home_loop
)
for %%I in ("%ES_HOME%..") do set ES_HOME=%%~dpfI
for %%I in ("%OPENSEARCH_HOME%..") do set OPENSEARCH_HOME=%%~dpfI
rem now set the classpath
set ES_CLASSPATH=!ES_HOME!\lib\*
set OPENSEARCH_CLASSPATH=!OPENSEARCH_HOME!\lib\*
set HOSTNAME=%COMPUTERNAME%
if not defined ES_PATH_CONF (
set ES_PATH_CONF=!ES_HOME!\config
if not defined OPENSEARCH_PATH_CONF (
set OPENSEARCH_PATH_CONF=!OPENSEARCH_HOME!\config
)
rem now make ES_PATH_CONF absolute
for %%I in ("%ES_PATH_CONF%..") do set ES_PATH_CONF=%%~dpfI
rem now make OPENSEARCH_PATH_CONF absolute
for %%I in ("%OPENSEARCH_PATH_CONF%..") do set OPENSEARCH_PATH_CONF=%%~dpfI
set ES_DISTRIBUTION_TYPE=${es.distribution.type}
set ES_BUNDLED_JDK=${es.bundled_jdk}
set OPENSEARCH_DISTRIBUTION_TYPE=${opensearch.distribution.type}
set OPENSEARCH_BUNDLED_JDK=${opensearch.bundled_jdk}
if "%ES_BUNDLED_JDK%" == "false" (
if "%OPENSEARCH_BUNDLED_JDK%" == "false" (
echo "warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release" >&2
)
cd /d "%ES_HOME%"
cd /d "%OPENSEARCH_HOME%"
rem now set the path to java, pass "nojava" arg to skip setting JAVA_HOME and JAVA
if "%1" == "nojava" (
@ -40,11 +40,11 @@ if "%1" == "nojava" (
)
rem compariing to empty string makes this equivalent to bash -v check on env var
rem and allows to effectively force use of the bundled jdk when launching ES
rem and allows to effectively force use of the bundled jdk when launching OpenSearch
rem by setting JAVA_HOME=
if "%JAVA_HOME%" == "" (
set JAVA="%ES_HOME%\jdk\bin\java.exe"
set JAVA_HOME="%ES_HOME%\jdk"
set JAVA="%OPENSEARCH_HOME%\jdk\bin\java.exe"
set JAVA_HOME="%OPENSEARCH_HOME%\jdk"
set JAVA_TYPE=bundled jdk
) else (
set JAVA="%JAVA_HOME%\bin\java.exe"
@ -66,9 +66,9 @@ rem JAVA_OPTS is not a built-in JVM mechanism but some people think it is so we
rem warn them that we are not observing the value of %JAVA_OPTS%
if defined JAVA_OPTS (
(echo|set /p=warning: ignoring JAVA_OPTS=%JAVA_OPTS%; )
echo pass JVM parameters via ES_JAVA_OPTS
echo pass JVM parameters via OPENSEARCH_JAVA_OPTS
)
rem check the Java version
%JAVA% -cp "%ES_CLASSPATH%" "org.elasticsearch.tools.java_version_checker.JavaVersionChecker" || exit /b 1
%JAVA% -cp "%OPENSEARCH_CLASSPATH%" "org.opensearch.tools.java_version_checker.JavaVersionChecker" || exit /b 1

View File

@ -1,6 +1,6 @@
#!/bin/bash
ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli \
ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli \
"`dirname "$0"`"/elasticsearch-cli \
OPENSEARCH_MAIN_CLASS=org.opensearch.common.settings.KeyStoreCli \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli \
"`dirname "$0"`"/opensearch-cli \
"$@"

View File

@ -3,9 +3,9 @@
setlocal enabledelayedexpansion
setlocal enableextensions
set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli
set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli
call "%~dp0elasticsearch-cli.bat" ^
set OPENSEARCH_MAIN_CLASS=org.opensearch.common.settings.KeyStoreCli
set OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli
call "%~dp0opensearch-cli.bat" ^
%%* ^
|| goto exit

View File

@ -1,5 +1,5 @@
#!/bin/bash
ES_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli \
OPENSEARCH_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli \
"`dirname "$0"`"/opensearch-cli \
"$@"

View File

@ -3,7 +3,7 @@
setlocal enabledelayedexpansion
setlocal enableextensions
set ES_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli
set OPENSEARCH_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli
call "%~dp0opensearch-cli.bat" ^
%%* ^
|| goto exit

View File

@ -1,6 +1,6 @@
#!/bin/bash
ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli \
ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli \
"`dirname "$0"`"/elasticsearch-cli \
OPENSEARCH_MAIN_CLASS=org.opensearch.plugins.PluginCli \
OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli \
"`dirname "$0"`"/opensearch-cli \
"$@"

View File

@ -3,12 +3,12 @@
setlocal enabledelayedexpansion
setlocal enableextensions
set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli
set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli
call "%~dp0elasticsearch-cli.bat" ^
set OPENSEARCH_MAIN_CLASS=org.opensearch.plugins.PluginCli
set OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli
call "%~dp0opensearch-cli.bat" ^
%%* ^
|| goto exit
endlocal
endlocal

View File

@ -6,20 +6,20 @@ setlocal enableextensions
set NOJAVA=nojava
if /i "%1" == "install" set NOJAVA=
call "%~dp0elasticsearch-env.bat" %NOJAVA% || exit /b 1
call "%~dp0opensearch-env.bat" %NOJAVA% || exit /b 1
set EXECUTABLE=%ES_HOME%\bin\elasticsearch-service-x64.exe
if "%SERVICE_ID%" == "" set SERVICE_ID=elasticsearch-service-x64
set EXECUTABLE=%OPENSEARCH_HOME%\bin\opensearch-service-x64.exe
if "%SERVICE_ID%" == "" set SERVICE_ID=opensearch-service-x64
set ARCH=64-bit
if EXIST "%EXECUTABLE%" goto okExe
echo elasticsearch-service-x64.exe was not found...
echo opensearch-service-x64.exe was not found...
exit /B 1
:okExe
set ES_VERSION=${project.version}
set OPENSEARCH_VERSION=${project.version}
if "%SERVICE_LOG_DIR%" == "" set SERVICE_LOG_DIR=%ES_HOME%\logs
if "%SERVICE_LOG_DIR%" == "" set SERVICE_LOG_DIR=%OPENSEARCH_HOME%\logs
if "x%1x" == "xx" goto displayUsage
set SERVICE_CMD=%1
@ -41,11 +41,11 @@ exit /B 1
:displayUsage
echo.
echo Usage: elasticsearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID]
echo Usage: opensearch-service.bat install^|remove^|start^|stop^|manager [SERVICE_ID]
goto:eof
:doStart
"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
"%EXECUTABLE%" //OPENSEARCH//%SERVICE_ID% %LOG_OPTS%
if not errorlevel 1 goto started
echo Failed starting '%SERVICE_ID%' service
exit /B 1
@ -65,8 +65,8 @@ echo The service '%SERVICE_ID%' has been stopped
goto:eof
:doManagment
set EXECUTABLE_MGR=%ES_HOME%\bin\elasticsearch-service-mgr
"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
set EXECUTABLE_MGR=%OPENSEARCH_HOME%\bin\opensearch-service-mgr
"%EXECUTABLE_MGR%" //OPENSEARCH//%SERVICE_ID%
if not errorlevel 1 goto managed
echo Failed starting service manager for '%SERVICE_ID%'
exit /B 1
@ -106,23 +106,23 @@ if exist "%JAVA_HOME%\bin\server\jvm.dll" (
)
:foundJVM
if not defined ES_TMPDIR (
for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"`) do set ES_TMPDIR=%%a
if not defined OPENSEARCH_TMPDIR (
for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!OPENSEARCH_CLASSPATH!" "org.opensearch.tools.launchers.TempDirectory"`) do set OPENSEARCH_TMPDIR=%%a
)
rem The JVM options parser produces the final JVM options to start
rem Elasticsearch. It does this by incorporating JVM options in the following
rem OpenSearch. It does this by incorporating JVM options in the following
rem way:
rem - first, system JVM options are applied (these are hardcoded options in
rem the parser)
rem - second, JVM options are read from jvm.options and
rem jvm.options.d/*.options
rem - third, JVM options from ES_JAVA_OPTS are applied
rem - third, JVM options from OPENSEARCH_JAVA_OPTS are applied
rem - fourth, ergonomic JVM options are applied
@setlocal
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_PATH_CONF!" ^|^| echo jvm_options_parser_failed`) do set ES_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%ES_JAVA_OPTS%" & set ES_JAVA_OPTS=%ES_JAVA_OPTS%
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!OPENSEARCH_CLASSPATH!" "org.opensearch.tools.launchers.JvmOptionsParser" "!OPENSEARCH_PATH_CONF!" ^|^| echo jvm_options_parser_failed`) do set OPENSEARCH_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%OPENSEARCH_JAVA_OPTS%" & set OPENSEARCH_JAVA_OPTS=%OPENSEARCH_JAVA_OPTS%
if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
exit /b 1
@ -131,18 +131,18 @@ if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
rem The output of the JVM options parses is space-delimited. We need to
rem convert to semicolon-delimited and avoid doubled semicolons.
@setlocal
if not "%ES_JAVA_OPTS%" == "" (
set ES_JAVA_OPTS=!ES_JAVA_OPTS: =;!
set ES_JAVA_OPTS=!ES_JAVA_OPTS:;;=;!
if not "%OPENSEARCH_JAVA_OPTS%" == "" (
set OPENSEARCH_JAVA_OPTS=!OPENSEARCH_JAVA_OPTS: =;!
set OPENSEARCH_JAVA_OPTS=!OPENSEARCH_JAVA_OPTS:;;=;!
)
@endlocal & set ES_JAVA_OPTS=%ES_JAVA_OPTS%
@endlocal & set OPENSEARCH_JAVA_OPTS=%OPENSEARCH_JAVA_OPTS%
if "%ES_JAVA_OPTS:~-1%"==";" set ES_JAVA_OPTS=%ES_JAVA_OPTS:~0,-1%
if "%OPENSEARCH_JAVA_OPTS:~-1%"==";" set OPENSEARCH_JAVA_OPTS=%OPENSEARCH_JAVA_OPTS:~0,-1%
echo %ES_JAVA_OPTS%
echo %OPENSEARCH_JAVA_OPTS%
@setlocal EnableDelayedExpansion
for %%a in ("%ES_JAVA_OPTS:;=","%") do (
for %%a in ("%OPENSEARCH_JAVA_OPTS:;=","%") do (
set var=%%a
set other_opt=true
if "!var:~1,4!" == "-Xms" (
@ -180,34 +180,34 @@ for %%a in ("%ES_JAVA_OPTS:;=","%") do (
@endlocal & set JVM_MS=%JVM_MS% & set JVM_MX=%JVM_MX% & set JVM_SS=%JVM_SS% & set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS%
if "%JVM_MS%" == "" (
echo minimum heap size not set; configure using -Xms via "%ES_PATH_CONF%/jvm.options.d", or ES_JAVA_OPTS
echo minimum heap size not set; configure using -Xms via "%OPENSEARCH_PATH_CONF%/jvm.options.d", or OPENSEARCH_JAVA_OPTS
goto:eof
)
if "%JVM_MX%" == "" (
echo maximum heap size not set; configure using -Xmx via "%ES_PATH_CONF%/jvm.options.d", or ES_JAVA_OPTS
echo maximum heap size not set; configure using -Xmx via "%OPENSEARCH_PATH_CONF%/jvm.options.d", or OPENSEARCH_JAVA_OPTS
goto:eof
)
if "%JVM_SS%" == "" (
echo thread stack size not set; configure using -Xss via "%ES_PATH_CONF%/jvm.options.d", or ES_JAVA_OPTS
echo thread stack size not set; configure using -Xss via "%OPENSEARCH_PATH_CONF%/jvm.options.d", or OPENSEARCH_JAVA_OPTS
goto:eof
)
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:"=%
set OTHER_JAVA_OPTS=%OTHER_JAVA_OPTS:~1%
set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%";-Des.distribution.type="%ES_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%ES_BUNDLED_JDK%"
set OPENSEARCH_PARAMS=-Dopensearch;-Des.path.home="%OPENSEARCH_HOME%";-Des.path.conf="%OPENSEARCH_PATH_CONF%";-Des.distribution.type="%OPENSEARCH_DISTRIBUTION_TYPE%";-Des.bundled_jdk="%OPENSEARCH_BUNDLED_JDK%"
if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0
if "%OPENSEARCH_START_TYPE%" == "" set OPENSEARCH_START_TYPE=manual
if "%OPENSEARCH_STOP_TIMEOUT%" == "" set OPENSEARCH_STOP_TIMEOUT=0
if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=Elasticsearch %ES_VERSION% (%SERVICE_ID%)
if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=Elasticsearch %ES_VERSION% Windows Service - https://elastic.co
if "%SERVICE_DISPLAY_NAME%" == "" set SERVICE_DISPLAY_NAME=OpenSearch %OPENSEARCH_VERSION% (%SERVICE_ID%)
if "%SERVICE_DESCRIPTION%" == "" set SERVICE_DESCRIPTION=OpenSearch %OPENSEARCH_VERSION% Windows Service - https://elastic.co
if not "%SERVICE_USERNAME%" == "" (
if not "%SERVICE_PASSWORD%" == "" (
set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%"
)
)
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %ES_START_TYPE% --StopTimeout %ES_STOP_TIMEOUT% --StartClass org.opensearch.bootstrap.OpenSearch --StartMethod main ++StartParams --quiet --StopClass org.opensearch.bootstrap.OpenSearch --StopMethod close --Classpath "%ES_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %ES_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%ES_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %OPENSEARCH_START_TYPE% --StopTimeout %OPENSEARCH_STOP_TIMEOUT% --StartClass org.opensearch.bootstrap.OpenSearch --StartMethod main ++StartParams --quiet --StopClass org.opensearch.bootstrap.OpenSearch --StopMethod close --Classpath "%OPENSEARCH_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %OPENSEARCH_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%OPENSEARCH_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"
if not errorlevel 1 goto installed
echo Failed installing '%SERVICE_ID%' service

View File

@ -1,5 +1,5 @@
#!/bin/bash
ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli \
"`dirname "$0"`"/elasticsearch-cli \
OPENSEARCH_MAIN_CLASS=org.opensearch.index.shard.ShardToolCli \
"`dirname "$0"`"/opensearch-cli \
"$@"

View File

@ -3,8 +3,8 @@
setlocal enabledelayedexpansion
setlocal enableextensions
set ES_MAIN_CLASS=org.elasticsearch.index.shard.ShardToolCli
call "%~dp0elasticsearch-cli.bat" ^
set OPENSEARCH_MAIN_CLASS=org.opensearch.index.shard.ShardToolCli
call "%~dp0opensearch-cli.bat" ^
%%* ^
|| goto exit

View File

@ -48,7 +48,7 @@ FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
)
)
CALL "%~dp0elasticsearch-env.bat" || exit /b 1
CALL "%~dp0opensearch-env.bat" || exit /b 1
IF ERRORLEVEL 1 (
IF NOT DEFINED nopauseonerror (
PAUSE
@ -58,9 +58,9 @@ IF ERRORLEVEL 1 (
SET KEYSTORE_PASSWORD=
IF "%checkpassword%"=="Y" (
CALL "%~dp0elasticsearch-keystore.bat" has-passwd --silent
CALL "%~dp0opensearch-keystore.bat" has-passwd --silent
IF !ERRORLEVEL! EQU 0 (
SET /P KEYSTORE_PASSWORD=Elasticsearch keystore password:
SET /P KEYSTORE_PASSWORD=OpenSearch keystore password:
IF !ERRORLEVEL! NEQ 0 (
ECHO Failed to read keystore password on standard input
EXIT /B !ERRORLEVEL!
@ -68,22 +68,22 @@ IF "%checkpassword%"=="Y" (
)
)
if not defined ES_TMPDIR (
for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.TempDirectory"`) do set ES_TMPDIR=%%a
if not defined OPENSEARCH_TMPDIR (
for /f "tokens=* usebackq" %%a in (`CALL %JAVA% -cp "!OPENSEARCH_CLASSPATH!" "org.opensearch.tools.launchers.TempDirectory"`) do set OPENSEARCH_TMPDIR=%%a
)
rem The JVM options parser produces the final JVM options to start
rem Elasticsearch. It does this by incorporating JVM options in the following
rem OpenSearch. It does this by incorporating JVM options in the following
rem way:
rem - first, system JVM options are applied (these are hardcoded options in
rem the parser)
rem - second, JVM options are read from jvm.options and
rem jvm.options.d/*.options
rem - third, JVM options from ES_JAVA_OPTS are applied
rem - third, JVM options from OPENSEARCH_JAVA_OPTS are applied
rem - fourth, ergonomic JVM options are applied
@setlocal
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!ES_CLASSPATH!" "org.elasticsearch.tools.launchers.JvmOptionsParser" "!ES_PATH_CONF!" ^|^| echo jvm_options_parser_failed`) do set ES_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%ES_JAVA_OPTS%" & set ES_JAVA_OPTS=%ES_JAVA_OPTS%
for /F "usebackq delims=" %%a in (`CALL %JAVA% -cp "!OPENSEARCH_CLASSPATH!" "org.opensearch.tools.launchers.JvmOptionsParser" "!OPENSEARCH_PATH_CONF!" ^|^| echo jvm_options_parser_failed`) do set OPENSEARCH_JAVA_OPTS=%%a
@endlocal & set "MAYBE_JVM_OPTIONS_PARSER_FAILED=%OPENSEARCH_JAVA_OPTS%" & set OPENSEARCH_JAVA_OPTS=%OPENSEARCH_JAVA_OPTS%
if "%MAYBE_JVM_OPTIONS_PARSER_FAILED%" == "jvm_options_parser_failed" (
exit /b 1
@ -97,11 +97,11 @@ SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^<=^^^<!
SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^>=^^^>!
SET KEYSTORE_PASSWORD=!KEYSTORE_PASSWORD:^\=^^^\!
ECHO.!KEYSTORE_PASSWORD!| %JAVA% %ES_JAVA_OPTS% -Delasticsearch ^
-Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" ^
-Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^
-Des.bundled_jdk="%ES_BUNDLED_JDK%" ^
-cp "%ES_CLASSPATH%" "org.opensearch.bootstrap.OpenSearch" !newparams!
ECHO.!KEYSTORE_PASSWORD!| %JAVA% %OPENSEARCH_JAVA_OPTS% -Dopensearch ^
-Des.path.home="%OPENSEARCH_HOME%" -Des.path.conf="%OPENSEARCH_PATH_CONF%" ^
-Des.distribution.type="%OPENSEARCH_DISTRIBUTION_TYPE%" ^
-Des.bundled_jdk="%OPENSEARCH_BUNDLED_JDK%" ^
-cp "%OPENSEARCH_CLASSPATH%" "org.opensearch.bootstrap.OpenSearch" !newparams!
endlocal
endlocal

View File

@ -1,6 +1,6 @@
# ======================== Elasticsearch Configuration =========================
# ======================== OpenSearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# NOTE: OpenSearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
@ -46,7 +46,7 @@ ${path.logs}
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
# OpenSearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#

View File

@ -48,7 +48,7 @@
14-:-XX:InitiatingHeapOccupancyPercent=30
## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}
-Djava.io.tmpdir=${OPENSEARCH_TMPDIR}
## heap dumps

View File

@ -8,11 +8,11 @@ appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%ma
######## Server JSON ############################
appender.rolling.type = RollingFile
appender.rolling.name = rolling
appender.rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_server.json
appender.rolling.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_server.json
appender.rolling.layout.type = ESJsonLayout
appender.rolling.layout.type_name = server
appender.rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.gz
appender.rolling.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}-%d{yyyy-MM-dd}-%i.json.gz
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 1
@ -22,20 +22,20 @@ appender.rolling.policies.size.size = 128MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.fileIndex = nomax
appender.rolling.strategy.action.type = Delete
appender.rolling.strategy.action.basepath = ${sys:es.logs.base_path}
appender.rolling.strategy.action.basepath = ${sys:opensearch.logs.base_path}
appender.rolling.strategy.action.condition.type = IfFileName
appender.rolling.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
appender.rolling.strategy.action.condition.glob = ${sys:opensearch.logs.cluster_name}-*
appender.rolling.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
appender.rolling.strategy.action.condition.nested_condition.exceeds = 2GB
################################################
######## Server - old style pattern ###########
appender.rolling_old.type = RollingFile
appender.rolling_old.name = rolling_old
appender.rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}.log
appender.rolling_old.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}.log
appender.rolling_old.layout.type = PatternLayout
appender.rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_old.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}-%d{yyyy-MM-dd}-%i.log.gz
appender.rolling_old.policies.type = Policies
appender.rolling_old.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling_old.policies.time.interval = 1
@ -45,9 +45,9 @@ appender.rolling_old.policies.size.size = 128MB
appender.rolling_old.strategy.type = DefaultRolloverStrategy
appender.rolling_old.strategy.fileIndex = nomax
appender.rolling_old.strategy.action.type = Delete
appender.rolling_old.strategy.action.basepath = ${sys:es.logs.base_path}
appender.rolling_old.strategy.action.basepath = ${sys:opensearch.logs.base_path}
appender.rolling_old.strategy.action.condition.type = IfFileName
appender.rolling_old.strategy.action.condition.glob = ${sys:es.logs.cluster_name}-*
appender.rolling_old.strategy.action.condition.glob = ${sys:opensearch.logs.cluster_name}-*
appender.rolling_old.strategy.action.condition.nested_condition.type = IfAccumulatedFileSize
appender.rolling_old.strategy.action.condition.nested_condition.exceeds = 2GB
################################################
@ -60,13 +60,13 @@ rootLogger.appenderRef.rolling_old.ref = rolling_old
######## Deprecation JSON #######################
appender.deprecation_rolling.type = RollingFile
appender.deprecation_rolling.name = deprecation_rolling
appender.deprecation_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.json
appender.deprecation_rolling.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_deprecation.json
appender.deprecation_rolling.layout.type = ESJsonLayout
appender.deprecation_rolling.layout.type_name = deprecation
appender.deprecation_rolling.layout.esmessagefields=x-opaque-id
appender.deprecation_rolling.layout.opensearchmessagefields=x-opaque-id
appender.deprecation_rolling.filter.rate_limit.type = RateLimitingFilter
appender.deprecation_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation-%i.json.gz
appender.deprecation_rolling.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_deprecation-%i.json.gz
appender.deprecation_rolling.policies.type = Policies
appender.deprecation_rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.deprecation_rolling.policies.size.size = 1GB
@ -79,11 +79,11 @@ appender.header_warning.name = header_warning
######## Deprecation - old style pattern #######
appender.deprecation_rolling_old.type = RollingFile
appender.deprecation_rolling_old.name = deprecation_rolling_old
appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log
appender.deprecation_rolling_old.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}_deprecation.log
appender.deprecation_rolling_old.layout.type = PatternLayout
appender.deprecation_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.deprecation_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.deprecation_rolling_old.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_deprecation-%i.log.gz
appender.deprecation_rolling_old.policies.type = Policies
appender.deprecation_rolling_old.policies.size.type = SizeBasedTriggeringPolicy
@ -91,7 +91,7 @@ appender.deprecation_rolling_old.policies.size.size = 1GB
appender.deprecation_rolling_old.strategy.type = DefaultRolloverStrategy
appender.deprecation_rolling_old.strategy.max = 4
#################################################
logger.deprecation.name = org.elasticsearch.deprecation
logger.deprecation.name = org.opensearch.deprecation
logger.deprecation.level = deprecation
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecation_rolling
logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old
@ -101,13 +101,13 @@ logger.deprecation.additivity = false
######## Search slowlog JSON ####################
appender.index_search_slowlog_rolling.type = RollingFile
appender.index_search_slowlog_rolling.name = index_search_slowlog_rolling
appender.index_search_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\
appender.index_search_slowlog_rolling.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs\
.cluster_name}_index_search_slowlog.json
appender.index_search_slowlog_rolling.layout.type = ESJsonLayout
appender.index_search_slowlog_rolling.layout.type_name = index_search_slowlog
appender.index_search_slowlog_rolling.layout.esmessagefields=message,took,took_millis,total_hits,types,stats,search_type,total_shards,source,id
appender.index_search_slowlog_rolling.layout.opensearchmessagefields=message,took,took_millis,total_hits,types,stats,search_type,total_shards,source,id
appender.index_search_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs\
appender.index_search_slowlog_rolling.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs\
.cluster_name}_index_search_slowlog-%i.json.gz
appender.index_search_slowlog_rolling.policies.type = Policies
appender.index_search_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy
@ -118,12 +118,12 @@ appender.index_search_slowlog_rolling.strategy.max = 4
######## Search slowlog - old style pattern ####
appender.index_search_slowlog_rolling_old.type = RollingFile
appender.index_search_slowlog_rolling_old.name = index_search_slowlog_rolling_old
appender.index_search_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_search_slowlog_rolling_old.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_search_slowlog.log
appender.index_search_slowlog_rolling_old.layout.type = PatternLayout
appender.index_search_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.index_search_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_search_slowlog_rolling_old.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_search_slowlog-%i.log.gz
appender.index_search_slowlog_rolling_old.policies.type = Policies
appender.index_search_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy
@ -140,13 +140,13 @@ logger.index_search_slowlog_rolling.additivity = false
######## Indexing slowlog JSON ##################
appender.index_indexing_slowlog_rolling.type = RollingFile
appender.index_indexing_slowlog_rolling.name = index_indexing_slowlog_rolling
appender.index_indexing_slowlog_rolling.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_indexing_slowlog_rolling.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_indexing_slowlog.json
appender.index_indexing_slowlog_rolling.layout.type = ESJsonLayout
appender.index_indexing_slowlog_rolling.layout.type_name = index_indexing_slowlog
appender.index_indexing_slowlog_rolling.layout.esmessagefields=message,took,took_millis,doc_type,id,routing,source
appender.index_indexing_slowlog_rolling.layout.opensearchmessagefields=message,took,took_millis,doc_type,id,routing,source
appender.index_indexing_slowlog_rolling.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_indexing_slowlog_rolling.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_indexing_slowlog-%i.json.gz
appender.index_indexing_slowlog_rolling.policies.type = Policies
appender.index_indexing_slowlog_rolling.policies.size.type = SizeBasedTriggeringPolicy
@ -157,12 +157,12 @@ appender.index_indexing_slowlog_rolling.strategy.max = 4
######## Indexing slowlog - old style pattern ##
appender.index_indexing_slowlog_rolling_old.type = RollingFile
appender.index_indexing_slowlog_rolling_old.name = index_indexing_slowlog_rolling_old
appender.index_indexing_slowlog_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_indexing_slowlog_rolling_old.fileName = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_indexing_slowlog.log
appender.index_indexing_slowlog_rolling_old.layout.type = PatternLayout
appender.index_indexing_slowlog_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
appender.index_indexing_slowlog_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
appender.index_indexing_slowlog_rolling_old.filePattern = ${sys:opensearch.logs.base_path}${sys:file.separator}${sys:opensearch.logs.cluster_name}\
_index_indexing_slowlog-%i.log.gz
appender.index_indexing_slowlog_rolling_old.policies.type = Policies
appender.index_indexing_slowlog_rolling_old.policies.size.type = SizeBasedTriggeringPolicy

View File

@ -1,4 +1,4 @@
apply plugin: 'elasticsearch.build'
apply plugin: 'opensearch.build'
targetCompatibility = JavaVersion.VERSION_1_7

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.java_version_checker;
package org.opensearch.tools.java_version_checker;
import java.util.ArrayList;
import java.util.List;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.java_version_checker;
package org.opensearch.tools.java_version_checker;
import java.util.Arrays;
import java.util.Locale;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.java_version_checker;
package org.opensearch.tools.java_version_checker;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;

View File

@ -17,11 +17,11 @@
* under the License.
*/
apply plugin: 'elasticsearch.build'
apply plugin: 'opensearch.build'
dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:opensearch-cli")
testImplementation project(":test:framework")
testImplementation 'com.google.jimfs:jimfs:1.1'
testRuntimeOnly 'com.google.guava:guava:18.0'

View File

@ -17,10 +17,12 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.elasticsearch.common.settings.BaseKeyStoreCommand;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.Terminal;
import org.opensearch.cli.UserException;

View File

@ -17,10 +17,12 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.elasticsearch.common.settings.BaseKeyStoreCommand;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.Terminal;
import org.opensearch.cli.UserException;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import java.nio.file.Files;
import java.nio.file.Path;
@ -25,6 +25,7 @@ import java.util.Arrays;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.KeyStoreAwareCommand;
import org.opensearch.cli.Terminal;
@ -39,7 +40,7 @@ class CreateKeyStoreCommand extends KeyStoreAwareCommand {
private final OptionSpec<Void> passwordOption;
CreateKeyStoreCommand() {
super("Creates a new elasticsearch keystore");
super("Creates a new opensearch keystore");
this.passwordOption = parser.acceptsAll(Arrays.asList("p", "password"), "Prompt for password to encrypt the keystore");
}
@ -48,16 +49,16 @@ class CreateKeyStoreCommand extends KeyStoreAwareCommand {
try (SecureString password = options.has(passwordOption) ? readPassword(terminal, true) : new SecureString(new char[0])) {
Path keystoreFile = KeyStoreWrapper.keystorePath(env.configFile());
if (Files.exists(keystoreFile)) {
if (terminal.promptYesNo("An elasticsearch keystore already exists. Overwrite?", false) == false) {
if (terminal.promptYesNo("An opensearch keystore already exists. Overwrite?", false) == false) {
terminal.println("Exiting without creating keystore.");
return;
}
}
KeyStoreWrapper keystore = KeyStoreWrapper.create();
keystore.save(env.configFile(), password.getChars());
terminal.println("Created elasticsearch keystore in " + KeyStoreWrapper.keystorePath(env.configFile()));
terminal.println("Created opensearch keystore in " + KeyStoreWrapper.keystorePath(env.configFile()));
} catch (SecurityException e) {
throw new UserException(ExitCodes.IO_ERROR, "Error creating the elasticsearch keystore.");
throw new UserException(ExitCodes.IO_ERROR, "Error creating the opensearch keystore.");
}
}
}

View File

@ -17,18 +17,21 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.ChangeKeyStorePasswordCommand;
import org.elasticsearch.common.settings.HasPasswordKeyStoreCommand;
import org.elasticsearch.common.settings.UpgradeKeyStoreCommand;
import org.opensearch.cli.LoggingAwareMultiCommand;
import org.opensearch.cli.Terminal;
/**
* A cli tool for managing secrets in the elasticsearch keystore.
* A cli tool for managing secrets in the opensearch keystore.
*/
public class KeyStoreCli extends LoggingAwareMultiCommand {
private KeyStoreCli() {
super("A tool for managing settings stored in the elasticsearch keystore");
super("A tool for managing settings stored in the opensearch keystore");
subcommands.put("create", new CreateKeyStoreCommand());
subcommands.put("list", new ListKeyStoreCommand());
subcommands.put("add", new AddStringKeyStoreCommand());

View File

@ -17,13 +17,15 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import joptsimple.OptionSet;
import org.elasticsearch.common.settings.BaseKeyStoreCommand;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.Terminal;
import org.elasticsearch.env.Environment;

View File

@ -17,10 +17,12 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.elasticsearch.common.settings.BaseKeyStoreCommand;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.Terminal;
import org.opensearch.cli.UserException;

View File

@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.bootstrap;
package org.opensearch.bootstrap;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.common.settings.KeyStoreCommandTestCase;
import org.opensearch.common.settings.KeyStoreCommandTestCase;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.elasticsearch.common.settings.SecureSettings;
import org.elasticsearch.common.settings.SecureString;
@ -67,11 +67,11 @@ public class BootstrapTests extends ESTestCase {
assertTrue(seed.length() > 0);
keyStoreWrapper.save(configPath, new char[0]);
}
assertTrue(Files.exists(configPath.resolve("elasticsearch.keystore")));
assertTrue(Files.exists(configPath.resolve("opensearch.keystore")));
try (SecureSettings secureSettings = Bootstrap.loadSecureSettings(env)) {
SecureString seedAfterLoad = KeyStoreWrapper.SEED_SETTING.get(Settings.builder().setSecureSettings(secureSettings).build());
assertEquals(seedAfterLoad.toString(), seed.toString());
assertTrue(Files.exists(configPath.resolve("elasticsearch.keystore")));
assertTrue(Files.exists(configPath.resolve("opensearch.keystore")));
}
}

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.Command;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.UserException;

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.Command;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.UserException;

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.ChangeKeyStorePasswordCommand;
import org.opensearch.cli.Command;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.UserException;

View File

@ -17,13 +17,14 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.cli.Command;
import org.opensearch.cli.ExitCodes;
import org.opensearch.cli.UserException;

View File

@ -17,8 +17,9 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.HasPasswordKeyStoreCommand;
import org.opensearch.cli.Command;
import org.opensearch.cli.UserException;
import org.elasticsearch.env.Environment;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import java.io.IOException;
import java.io.InputStream;
@ -29,6 +29,8 @@ import java.util.List;
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.internal.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.cli.CommandTestCase;
@ -39,7 +41,7 @@ import org.junit.After;
import org.junit.Before;
/**
* Base test case for manipulating the ES keystore.
* Base test case for manipulating the OpenSearch keystore.
*/
@LuceneTestCase.SuppressFileSystems("*") // we do our own mocking
public abstract class KeyStoreCommandTestCase extends CommandTestCase {
@ -67,7 +69,7 @@ public abstract class KeyStoreCommandTestCase extends CommandTestCase {
}
FileSystem fs = Jimfs.newFileSystem(configuration);
fileSystems.add(fs);
PathUtilsForTesting.installMock(fs); // restored by restoreFileSystem in ESTestCase
PathUtilsForTesting.installMock(fs); // restored by restoreFileSystem in OpenSearchTestCase
Path home = fs.getPath("/", "test-home");
Files.createDirectories(home.resolve("config"));
return TestEnvironment.newEnvironment(Settings.builder().put("path.home", home).build());

View File

@ -17,12 +17,13 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.SimpleFSDirectory;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.opensearch.common.Randomness;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.env.Environment;
@ -180,8 +181,8 @@ public class KeyStoreWrapperTests extends ESTestCase {
public void testFailWhenCannotConsumeSecretStream() throws Exception {
Path configDir = env.configFile();
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
try (IndexOutput indexOutput = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "elasticsearch.keystore", 3);
try (IndexOutput indexOutput = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "opensearch.keystore", 3);
indexOutput.writeByte((byte) 0); // No password
SecureRandom random = Randomness.createSecure();
byte[] salt = new byte[64];
@ -208,8 +209,8 @@ public class KeyStoreWrapperTests extends ESTestCase {
public void testFailWhenCannotConsumeEncryptedBytesStream() throws Exception {
Path configDir = env.configFile();
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
try (IndexOutput indexOutput = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "elasticsearch.keystore", 3);
try (IndexOutput indexOutput = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "opensearch.keystore", 3);
indexOutput.writeByte((byte) 0); // No password
SecureRandom random = Randomness.createSecure();
byte[] salt = new byte[64];
@ -237,8 +238,8 @@ public class KeyStoreWrapperTests extends ESTestCase {
public void testFailWhenSecretStreamNotConsumed() throws Exception {
Path configDir = env.configFile();
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
try (IndexOutput indexOutput = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "elasticsearch.keystore", 3);
try (IndexOutput indexOutput = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "opensearch.keystore", 3);
indexOutput.writeByte((byte) 0); // No password
SecureRandom random = Randomness.createSecure();
byte[] salt = new byte[64];
@ -264,8 +265,8 @@ public class KeyStoreWrapperTests extends ESTestCase {
public void testFailWhenEncryptedBytesStreamIsNotConsumed() throws Exception {
Path configDir = env.configFile();
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
try (IndexOutput indexOutput = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "elasticsearch.keystore", 3);
try (IndexOutput indexOutput = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(indexOutput, "opensearch.keystore", 3);
indexOutput.writeByte((byte) 0); // No password
SecureRandom random = Randomness.createSecure();
byte[] salt = new byte[64];
@ -350,8 +351,8 @@ public class KeyStoreWrapperTests extends ESTestCase {
assumeFalse("Can't run in a FIPS JVM as PBE is not available", inFipsJvm());
Path configDir = env.configFile();
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
try (IndexOutput output = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(output, "elasticsearch.keystore", 1);
try (IndexOutput output = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(output, "opensearch.keystore", 1);
output.writeByte((byte) 0); // hasPassword = false
output.writeString("PKCS12");
output.writeString("PBE");
@ -383,9 +384,9 @@ public class KeyStoreWrapperTests extends ESTestCase {
SimpleFSDirectory directory = new SimpleFSDirectory(configDir);
byte[] fileBytes = new byte[20];
random().nextBytes(fileBytes);
try (IndexOutput output = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)) {
try (IndexOutput output = directory.createOutput("opensearch.keystore", IOContext.DEFAULT)) {
CodecUtil.writeHeader(output, "elasticsearch.keystore", 2);
CodecUtil.writeHeader(output, "opensearch.keystore", 2);
output.writeByte((byte) 0); // hasPassword = false
output.writeString("PKCS12");
output.writeString("PBE"); // string algo
@ -456,9 +457,9 @@ public class KeyStoreWrapperTests extends ESTestCase {
public void testLegacyV3() throws GeneralSecurityException, IOException {
final Path configDir = createTempDir();
final Path keystore = configDir.resolve("elasticsearch.keystore");
final Path keystore = configDir.resolve("opensearch.keystore");
try (
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-opensearch.keystore");
OutputStream os = Files.newOutputStream(keystore)
) {
final byte[] buffer = new byte[4096];

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import java.util.Map;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.opensearch.cli.Command;
import org.opensearch.cli.ExitCodes;

View File

@ -17,8 +17,10 @@
* under the License.
*/
package org.elasticsearch.common.settings;
package org.opensearch.common.settings;
import org.elasticsearch.common.settings.KeyStoreWrapper;
import org.elasticsearch.common.settings.UpgradeKeyStoreCommand;
import org.opensearch.cli.Command;
import org.opensearch.cli.UserException;
import org.elasticsearch.env.Environment;
@ -51,7 +53,7 @@ public class UpgradeKeyStoreCommandTests extends KeyStoreCommandTestCase {
public void testKeystoreUpgrade() throws Exception {
final Path keystore = KeyStoreWrapper.keystorePath(env.configFile());
try (
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-elasticsearch.keystore");
InputStream is = KeyStoreWrapperTests.class.getResourceAsStream("/format-v3-opensearch.keystore");
OutputStream os = Files.newOutputStream(keystore)
) {
final byte[] buffer = new byte[4096];

View File

@ -18,7 +18,7 @@
*/
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
apply plugin: 'elasticsearch.build'
apply plugin: 'opensearch.build'
dependencies {
compileOnly project(':distribution:tools:java-version-checker')
@ -27,7 +27,7 @@ dependencies {
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
}
archivesBaseName = 'elasticsearch-launchers'
archivesBaseName = 'opensearch-launchers'
tasks.withType(CheckForbiddenApis).configureEach {
replaceSignatureFiles 'jdk-signatures'
@ -37,7 +37,7 @@ testingConventions {
naming.clear()
naming {
Tests {
baseClass 'org.elasticsearch.tools.launchers.LaunchersTestCase'
baseClass 'org.opensearch.tools.launchers.LaunchersTestCase'
}
}
}

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import org.elasticsearch.tools.java_version_checker.JavaVersion;
import org.opensearch.tools.java_version_checker.JavaVersion;
import java.io.BufferedReader;
import java.io.IOException;

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import org.elasticsearch.tools.java_version_checker.JavaVersion;
import org.opensearch.tools.java_version_checker.JavaVersion;
import java.io.BufferedReader;
import java.io.IOException;
@ -75,24 +75,24 @@ final class JvmOptionsParser {
* The main entry point. The exit code is 0 if the JVM options were successfully parsed, otherwise the exit code is 1. If an improperly
* formatted line is discovered, the line is output to standard error.
*
* @param args the args to the program which should consist of a single option, the path to ES_PATH_CONF
* @param args the args to the program which should consist of a single option, the path to OPENSEARCH_PATH_CONF
*/
public static void main(final String[] args) throws InterruptedException, IOException {
if (args.length != 1) {
throw new IllegalArgumentException("expected one argument specifying path to ES_PATH_CONF but was " + Arrays.toString(args));
throw new IllegalArgumentException("expected one argument specifying path to OPENSEARCH_PATH_CONF but was " + Arrays.toString(args));
}
final JvmOptionsParser parser = new JvmOptionsParser();
final Map<String, String> substitutions = new HashMap<>();
substitutions.put("ES_TMPDIR", System.getenv("ES_TMPDIR"));
final String environmentPathConf = System.getenv("ES_PATH_CONF");
substitutions.put("OPENSEARCH_TMPDIR", System.getenv("OPENSEARCH_TMPDIR"));
final String environmentPathConf = System.getenv("OPENSEARCH_PATH_CONF");
if (environmentPathConf != null) {
substitutions.put("ES_PATH_CONF", environmentPathConf);
substitutions.put("OPENSEARCH_PATH_CONF", environmentPathConf);
}
try {
final List<String> jvmOptions = parser.jvmOptions(Paths.get(args[0]), System.getenv("ES_JAVA_OPTS"), substitutions);
final List<String> jvmOptions = parser.jvmOptions(Paths.get(args[0]), System.getenv("OPENSEARCH_JAVA_OPTS"), substitutions);
Launchers.outPrintln(String.join(" ", jvmOptions));
} catch (final JvmOptionsFileParserException e) {
final String errorMessage = String.format(
@ -122,14 +122,14 @@ final class JvmOptionsParser {
Launchers.exit(0);
}
private List<String> jvmOptions(final Path config, final String esJavaOpts, final Map<String, String> substitutions)
private List<String> jvmOptions(final Path config, final String opensearchJavaOpts, final Map<String, String> substitutions)
throws InterruptedException, IOException, JvmOptionsFileParserException {
final List<String> jvmOptions = readJvmOptionsFiles(config);
if (esJavaOpts != null) {
if (opensearchJavaOpts != null) {
jvmOptions.addAll(
Arrays.stream(esJavaOpts.split("\\s+")).filter(s -> s.trim().isEmpty() == false).collect(Collectors.toList())
Arrays.stream(opensearchJavaOpts.split("\\s+")).filter(s -> s.trim().isEmpty() == false).collect(Collectors.toList())
);
}

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import org.elasticsearch.tools.java_version_checker.SuppressForbidden;
import org.opensearch.tools.java_version_checker.SuppressForbidden;
import java.io.IOException;
import java.nio.file.Files;

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import org.elasticsearch.tools.java_version_checker.JavaVersion;
import org.opensearch.tools.java_version_checker.JavaVersion;
import java.util.Arrays;
import java.util.Collections;
@ -86,10 +86,10 @@ final class SystemJvmOptions {
* in jdk8 it has to be loaded from jre/lib/ext,
* in jdk9+ it is already within ES project and on a classpath
*
* Due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise time/date
* Due to internationalization enhancements in JDK 9 OpenSearch need to set the provider to COMPAT otherwise time/date
* parsing will break in an incompatible way for some date patterns and locales.
* //TODO COMPAT will be deprecated in jdk14 https://bugs.openjdk.java.net/browse/JDK-8232906
* See also: documentation in <code>server/org.elasticsearch.common.time.IsoCalendarDataProvider</code>
* See also: documentation in <code>server/org.opensearch.common.time.IsoCalendarDataProvider</code>
*/
if (JavaVersion.majorVersion(JavaVersion.CURRENT) == 8) {
return "-Djava.locale.providers=SPI,JRE";

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import java.io.IOException;
import java.nio.file.Files;
@ -48,10 +48,10 @@ final class TempDirectory {
*/
final Path path;
if (System.getProperty("os.name").startsWith("Windows")) {
path = Paths.get(System.getProperty("java.io.tmpdir"), "elasticsearch");
path = Paths.get(System.getProperty("java.io.tmpdir"), "opensearch");
Files.createDirectories(path);
} else {
path = Launchers.createTempDirectory("elasticsearch-");
path = Launchers.createTempDirectory("opensearch-");
}
Launchers.outPrintln(path.toString());
}

View File

@ -17,9 +17,9 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import org.elasticsearch.tools.java_version_checker.JavaVersion;
import org.opensearch.tools.java_version_checker.JavaVersion;
import java.io.IOException;
import java.util.Arrays;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import java.io.BufferedReader;
import java.io.IOException;
@ -49,10 +49,10 @@ public class JvmOptionsParserTests extends LaunchersTestCase {
public void testSubstitution() {
final List<String> jvmOptions = JvmOptionsParser.substitutePlaceholders(
Collections.singletonList("-Djava.io.tmpdir=${ES_TMPDIR}"),
Collections.singletonMap("ES_TMPDIR", "/tmp/elasticsearch")
Collections.singletonList("-Djava.io.tmpdir=${OPENSEARCH_TMPDIR}"),
Collections.singletonMap("OPENSEARCH_TMPDIR", "/tmp/opensearch")
);
assertThat(jvmOptions, contains("-Djava.io.tmpdir=/tmp/elasticsearch"));
assertThat(jvmOptions, contains("-Djava.io.tmpdir=/tmp/opensearch"));
}
public void testUnversionedOptions() throws IOException {

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.tools.launchers;
package org.opensearch.tools.launchers;
import com.carrotsearch.randomizedtesting.JUnit3MethodProvider;
import com.carrotsearch.randomizedtesting.MixWithSuiteName;

View File

@ -17,13 +17,13 @@
* under the License.
*/
apply plugin: 'elasticsearch.build'
apply plugin: 'opensearch.build'
archivesBaseName = 'elasticsearch-plugin-cli'
archivesBaseName = 'opensearch-plugin-cli'
dependencies {
compileOnly project(":server")
compileOnly project(":libs:elasticsearch-cli")
compileOnly project(":libs:opensearch-cli")
api "org.bouncycastle:bcpg-fips:1.0.4"
api "org.bouncycastle:bc-fips:1.0.2"
testImplementation project(":test:framework")

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
@ -92,11 +92,11 @@ import java.util.zip.ZipInputStream;
import static org.opensearch.cli.Terminal.Verbosity.VERBOSE;
/**
* A command for the plugin cli to install a plugin into elasticsearch.
* A command for the plugin cli to install a plugin into opensearch.
*
* The install command takes a plugin id, which may be any of the following:
* <ul>
* <li>An official elasticsearch plugin name</li>
* <li>An official opensearch plugin name</li>
* <li>Maven coordinates to a plugin zip</li>
* <li>A URL to a plugin zip</li>
* </ul>
@ -107,23 +107,23 @@ import static org.opensearch.cli.Terminal.Verbosity.VERBOSE;
* The installation process first extracts the plugin files into a temporary
* directory in order to verify the plugin satisfies the following requirements:
* <ul>
* <li>Jar hell does not exist, either between the plugin's own jars, or with elasticsearch</li>
* <li>The plugin is not a module already provided with elasticsearch</li>
* <li>Jar hell does not exist, either between the plugin's own jars, or with opensearch</li>
* <li>The plugin is not a module already provided with opensearch</li>
* <li>If the plugin contains extra security permissions, the policy file is validated</li>
* </ul>
* <p>
* A plugin may also contain an optional {@code bin} directory which contains scripts. The
* scripts will be installed into a subdirectory of the elasticsearch bin directory, using
* scripts will be installed into a subdirectory of the opensearch bin directory, using
* the name of the plugin, and the scripts will be marked executable.
* <p>
* A plugin may also contain an optional {@code config} directory which contains configuration
* files specific to the plugin. The config files be installed into a subdirectory of the
* elasticsearch config directory, using the name of the plugin. If any files to be installed
* opensearch config directory, using the name of the plugin. If any files to be installed
* already exist, they will be skipped.
*/
class InstallPluginCommand extends EnvironmentAwareCommand {
private static final String PROPERTY_STAGING_ID = "es.plugins.staging";
private static final String PROPERTY_STAGING_ID = "opensearch.plugins.staging";
// exit codes for install
/** A plugin with the same name is already installed. */
@ -371,7 +371,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
);
}
/** Returns the url for an elasticsearch plugin in maven. */
/** Returns the url for an opensearch plugin in maven. */
private String getMavenUrl(Terminal terminal, String[] coordinates, String platform) throws IOException {
final String groupId = coordinates[0].replace(".", "/");
final String artifactId = coordinates[1];
@ -396,7 +396,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
URL url = new URL(urlString);
assert "https".equals(url.getProtocol()) : "Only http urls can be checked";
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.addRequestProperty("User-Agent", "elasticsearch-plugin-installer");
urlConnection.addRequestProperty("User-Agent", "opensearch-plugin-installer");
urlConnection.setRequestMethod("HEAD");
urlConnection.connect();
return urlConnection.getResponseCode() == 200;
@ -424,7 +424,7 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
URL url = new URL(urlString);
Path zip = Files.createTempFile(tmpDir, null, ".zip");
URLConnection urlConnection = url.openConnection();
urlConnection.addRequestProperty("User-Agent", "elasticsearch-plugin-installer");
urlConnection.addRequestProperty("User-Agent", "opensearch-plugin-installer");
try (
InputStream in = isBatch
? urlConnection.getInputStream()
@ -696,11 +696,11 @@ class InstallPluginCommand extends EnvironmentAwareCommand {
ZipEntry entry;
byte[] buffer = new byte[8192];
while ((entry = zipInput.getNextEntry()) != null) {
if (entry.getName().startsWith("elasticsearch/")) {
if (entry.getName().startsWith("opensearch/")) {
throw new UserException(
PLUGIN_MALFORMED,
"This plugin was built with an older plugin structure."
+ " Contact the plugin author to remove the intermediate \"elasticsearch\" directory within the plugin zip."
+ " Contact the plugin author to remove the intermediate \"opensearch\" directory within the plugin zip."
);
}
Path targetFile = target.resolve(entry.getName());

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import joptsimple.OptionSet;
import org.opensearch.Version;
@ -34,12 +34,12 @@ import java.util.Collections;
import java.util.List;
/**
* A command for the plugin cli to list plugins installed in elasticsearch.
* A command for the plugin cli to list plugins installed in opensearch.
*/
class ListPluginsCommand extends EnvironmentAwareCommand {
ListPluginsCommand() {
super("Lists installed elasticsearch plugins");
super("Lists installed opensearch plugins");
}
@Override

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import org.elasticsearch.core.internal.io.IOUtils;
import org.opensearch.cli.Command;
@ -29,14 +29,14 @@ import java.util.Collection;
import java.util.Collections;
/**
* A cli tool for adding, removing and listing plugins for elasticsearch.
* A cli tool for adding, removing and listing plugins for opensearch.
*/
public class PluginCli extends LoggingAwareMultiCommand {
private final Collection<Command> commands;
private PluginCli() {
super("A tool for managing installed elasticsearch plugins");
super("A tool for managing installed opensearch plugins");
subcommands.put("list", new ListPluginsCommand());
subcommands.put("install", new InstallPluginCommand());
subcommands.put("remove", new RemovePluginCommand());

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import java.io.FilterInputStream;
import java.io.IOException;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
@ -115,7 +115,7 @@ class RemovePluginCommand extends EnvironmentAwareCommand {
|| (!Files.exists(pluginDir) && Files.exists(pluginConfigDir) && !purge)) {
final String message = String.format(
Locale.ROOT,
"plugin [%s] not found; run 'elasticsearch-plugin list' to get list of installed plugins",
"plugin [%s] not found; run 'opensearch-plugin list' to get list of installed plugins",
pluginName
);
throw new UserException(ExitCodes.CONFIG, message);

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import com.google.common.jimfs.Configuration;
@ -204,9 +204,9 @@ public class InstallPluginCommandTests extends ESTestCase {
static Tuple<Path, Environment> createEnv(FileSystem fs, Function<String, Path> temp) throws IOException {
Path home = temp.apply("install-plugin-command-tests");
Files.createDirectories(home.resolve("bin"));
Files.createFile(home.resolve("bin").resolve("elasticsearch"));
Files.createFile(home.resolve("bin").resolve("opensearch"));
Files.createDirectories(home.resolve("config"));
Files.createFile(home.resolve("config").resolve("elasticsearch.yml"));
Files.createFile(home.resolve("config").resolve("opensearch.yml"));
Path plugins = Files.createDirectories(home.resolve("plugins"));
assertTrue(Files.exists(plugins));
Settings settings = Settings.builder().put("path.home", home).build();
@ -256,7 +256,7 @@ public class InstallPluginCommandTests extends ESTestCase {
name,
"version",
"1.0",
"elasticsearch.version",
"opensearch.version",
Version.CURRENT.toString(),
"java.version",
System.getProperty("java.specification.version"),
@ -460,7 +460,7 @@ public class InstallPluginCommandTests extends ESTestCase {
final IllegalStateException e = expectThrows(IllegalStateException.class, () -> installPlugin(pluginZip, env.v1()));
final String expected = String.format(
Locale.ROOT,
"found file [%s] from a failed attempt to remove the plugin [failed]; execute [elasticsearch-plugin remove failed]",
"found file [%s] from a failed attempt to remove the plugin [failed]; execute [opensearch-plugin remove failed]",
removing
);
assertThat(e, hasToString(containsString(expected)));
@ -603,9 +603,9 @@ public class InstallPluginCommandTests extends ESTestCase {
Path binDir = pluginDir.resolve("bin");
Files.createDirectory(binDir);
Files.createFile(binDir.resolve("somescript"));
String pluginZip = createPluginUrl("elasticsearch", pluginDir);
String pluginZip = createPluginUrl("opensearch", pluginDir);
FileAlreadyExistsException e = expectThrows(FileAlreadyExistsException.class, () -> installPlugin(pluginZip, env.v1()));
assertTrue(e.getMessage(), e.getMessage().contains(env.v2().binFile().resolve("elasticsearch").toString()));
assertTrue(e.getMessage(), e.getMessage().contains(env.v2().binFile().resolve("opensearch").toString()));
assertInstallCleaned(env.v2());
}
@ -756,7 +756,7 @@ public class InstallPluginCommandTests extends ESTestCase {
Tuple<Path, Environment> env = createEnv(fs, temp);
Path pluginDir = createPluginDir(temp);
Files.createFile(pluginDir.resolve(PluginInfo.ES_PLUGIN_PROPERTIES));
String pluginZip = writeZip(pluginDir, "elasticsearch").toUri().toURL().toString();
String pluginZip = writeZip(pluginDir, "opensearch").toUri().toURL().toString();
UserException e = expectThrows(UserException.class, () -> installPlugin(pluginZip, env.v1()));
assertThat(e.getMessage(), containsString("This plugin was built with an older plugin structure"));
assertInstallCleaned(env.v2());

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import java.io.IOException;
import java.nio.file.Files;
@ -104,7 +104,7 @@ public class ListPluginsCommandTests extends ESTestCase {
name,
"version",
"1.0",
"elasticsearch.version",
"opensearch.version",
Version.CURRENT.toString(),
"java.version",
"1.8",
@ -248,7 +248,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"fake_plugin1",
"version",
"1.0",
"elasticsearch.version",
"opensearch.version",
Version.fromString("1.0.0").toString(),
"java.version",
System.getProperty("java.specification.version"),

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import org.elasticsearch.test.ESTestCase;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.plugins;
package org.opensearch.plugins;
import org.apache.lucene.util.LuceneTestCase;
import org.opensearch.Version;
@ -71,7 +71,7 @@ public class RemovePluginCommandTests extends ESTestCase {
super.setUp();
home = createTempDir();
Files.createDirectories(home.resolve("bin"));
Files.createFile(home.resolve("bin").resolve("elasticsearch"));
Files.createFile(home.resolve("bin").resolve("opensearch"));
Files.createDirectories(home.resolve("plugins"));
Settings settings = Settings.builder().put("path.home", home).build();
env = TestEnvironment.newEnvironment(settings);
@ -98,7 +98,7 @@ public class RemovePluginCommandTests extends ESTestCase {
name,
"version",
"1.0",
"elasticsearch.version",
"opensearch.version",
version.toString(),
"java.version",
System.getProperty("java.specification.version"),
@ -162,7 +162,7 @@ public class RemovePluginCommandTests extends ESTestCase {
Files.createFile(binDir.resolve("somescript"));
removePlugin("fake", home, randomBoolean());
assertFalse(Files.exists(env.pluginsFile().resolve("fake")));
assertTrue(Files.exists(env.binFile().resolve("elasticsearch")));
assertTrue(Files.exists(env.binFile().resolve("opensearch")));
assertFalse(Files.exists(binDir));
assertRemoveCleaned(env);
}
@ -235,7 +235,7 @@ public class RemovePluginCommandTests extends ESTestCase {
public void testRemoveUninstalledPluginErrors() throws Exception {
UserException e = expectThrows(UserException.class, () -> removePlugin("fake", home, randomBoolean()));
assertEquals(ExitCodes.CONFIG, e.exitCode);
assertEquals("plugin [fake] not found; run 'elasticsearch-plugin list' to get list of installed plugins", e.getMessage());
assertEquals("plugin [fake] not found; run 'opensearch-plugin list' to get list of installed plugins", e.getMessage());
MockTerminal terminal = new MockTerminal();
@ -250,7 +250,7 @@ public class RemovePluginCommandTests extends ESTestCase {
) {
assertEquals("-> removing [fake]...", reader.readLine());
assertEquals(
"ERROR: plugin [fake] not found; run 'elasticsearch-plugin list' to get list of installed plugins",
"ERROR: plugin [fake] not found; run 'opensearch-plugin list' to get list of installed plugins",
errorReader.readLine()
);
assertNull(reader.readLine());