Elasticsearch安装

info

# elasticsearch info
version:       7.14.0
ip:            192.101.11.69
cluster port:  19200
install path:  /opt/tools/es7140

info-test

# elasticsearch info
version:       7.14.0
ip:            192.101.11.72
cluster port:  19200
install path:  /opt/tools/es7140

download

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.14.0

start

docker run --name es7140 --restart=always -d -p 19200:9200 -p 19300:9300 -e ES_JAVA_OPTS="-Xms1024m -Xmx3096m" -e "discovery.type=single-node" -e "http.cors.enabled=true" -e "http.cors.allow-origin=*" docker.elastic.co/elasticsearch/elasticsearch:7.14.0

start with password

  • init
mkdir -p /home/esdata/data
chmod 777 /home/esdata/data
mkdir -p /opt/tools/es7140/logs
chmod 777 /opt/tools/es7140/logs

vim /opt/tools/es7140/elasticsearch.yml
cluster.name: "hlappescls"
network.host: 0.0.0.0
xpack.security.enabled: true
  • run
docker run --name es7140 -d -p 19200:9200 -p 19300:9300 \
--restart=always \
--privileged=true \
-e ES_JAVA_OPTS="-Xms1024m -Xmx3096m" \
-e "discovery.type=single-node" \
-e "http.cors.enabled=true" \
-e "http.cors.allow-origin=*" \
-v /opt/tools/es7140/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /home/esdata/data:/usr/share/elasticsearch/data \
-v /opt/tools/es7140/logs:/usr/share/elasticsearch/logs \
docker.elastic.co/elasticsearch/elasticsearch:7.14.0
  • set password
docker exec -it es7140 sh
cd bin
elasticsearch-setup-passwords interactive

#Changed password for user [elastic]			hlappescls
#Changed password for user [apm_system]			123456
#Changed password for user [kibana_system]		123456
#Changed password for user [kibana]				123456
#Changed password for user [logstash_system]	123456
#Changed password for user [beats_system]		123456
#Changed password for user [remote_monitoring_user]	123456
  • test
curl -u 'elastic:hlappescls' -XGET 192.101.11.72:19200
{
  "name" : "e6ee75c16b3f",
  "cluster_name" : "hlappescls",
  "cluster_uuid" : "YY0_7DJMSD2scWDVy7UshA",
  "version" : {
    "number" : "7.14.0",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "dd5a0a2acaa2045ff9624f3729fc8a6f40835aa1",
    "build_date" : "2021-07-29T20:49:32.864135063Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}