Elasticsearch 시리즈 - 설치 배포
16997 단어 elasticsearch
Elasticsearch 시리즈 - 설치 배포
준비
1. 서버에서 es 사용자 만들기useradd es
passwd es
2.elasticsearch 배포 환경 JDK
3. 패키지를 설치하면 엘라스틱 홈페이지에 가서 해당 버전 파일을 다운로드할 수 있다.제가 여기에 설치한 버전은 7.12.0입니다.Linux 버전://centos curl
yum install curl
// es
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz
설치
다운로드한 압축 파일 압축 해제tar -xzvf elasticsearch-7.12.0-linux-x86_64.tar.gz
elasticsearch 시작cd elasticsearch-7.12.0/bin/
./elasticsearch &
elasticsearch 방문curl http://127.0.0.1:9200
//
{
"name" : "izwz9ja3exxb7by25st5gbz",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "hD8cxBoIRvW6tZUEIFMTUQ",
"version" : {
"number" : "7.12.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "78722783c38caa25a70982b5b042074cde5d3b3a",
"build_date" : "2021-03-18T06:17:15.410153305Z",
"build_snapshot" : false,
"lucene_version" : "8.8.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
클러스터 시작: 구성 파일 수정vim elasticsearch.yml
//
cluster.name: elasticsearch
//
node.name: node-1
//
path.data: /path/to/data
//
path.logs: /path/to/logs
// 0.0.0.0
network.host: 0.0.0.0
//
http.port: 9200
//
discovery.seed_hosts: ["172.18.88.96", "127.0.0.1"]
//
cluster.initial_master_nodes: ["node-1", "node-2"]
클러스터 노드 시작./elasticsearch -Epath.data=data1 -Epath.logs=log1 -Enode.name=node-1 -d
./elasticsearch -Epath.data=data2 -Epath.logs=log2 -Enode.name=node-2 -d
./elasticsearch -Epath.data=data3 -Epath.logs=log3 -Enode.name=node-3 -d
그룹 건강 정보 보기:curlhttp://localhost:9200/_cluster/health curl http://localhost:9200/_cat/health?v=true노드 목록 보기curlhttp://localhost:9200/_cat/nodes노드 정보 보기curlhttp://localhost:9200/_nodes/transport?pretty
잘못
useradd es
passwd es
//centos curl
yum install curl
// es
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.0-linux-x86_64.tar.gz
다운로드한 압축 파일 압축 해제
tar -xzvf elasticsearch-7.12.0-linux-x86_64.tar.gz
elasticsearch 시작
cd elasticsearch-7.12.0/bin/
./elasticsearch &
elasticsearch 방문
curl http://127.0.0.1:9200
//
{
"name" : "izwz9ja3exxb7by25st5gbz",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "hD8cxBoIRvW6tZUEIFMTUQ",
"version" : {
"number" : "7.12.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "78722783c38caa25a70982b5b042074cde5d3b3a",
"build_date" : "2021-03-18T06:17:15.410153305Z",
"build_snapshot" : false,
"lucene_version" : "8.8.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
클러스터 시작: 구성 파일 수정
vim elasticsearch.yml
//
cluster.name: elasticsearch
//
node.name: node-1
//
path.data: /path/to/data
//
path.logs: /path/to/logs
// 0.0.0.0
network.host: 0.0.0.0
//
http.port: 9200
//
discovery.seed_hosts: ["172.18.88.96", "127.0.0.1"]
//
cluster.initial_master_nodes: ["node-1", "node-2"]
클러스터 노드 시작
./elasticsearch -Epath.data=data1 -Epath.logs=log1 -Enode.name=node-1 -d
./elasticsearch -Epath.data=data2 -Epath.logs=log2 -Enode.name=node-2 -d
./elasticsearch -Epath.data=data3 -Epath.logs=log3 -Enode.name=node-3 -d
그룹 건강 정보 보기:curlhttp://localhost:9200/_cluster/health curl http://localhost:9200/_cat/health?v=true노드 목록 보기curlhttp://localhost:9200/_cat/nodes노드 정보 보기curlhttp://localhost:9200/_nodes/transport?pretty
잘못
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
warning: ignoring JAVA_OPTS= -Djava.security.egd=file:/dev/./urandom; pass JVM parameters via ES_JAVA_OPTS
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk1.8.0_171/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
warning: ignoring JAVA_OPTS= -Djava.security.egd=file:/dev/./urandom; pass JVM parameters via ES_JAVA_OPTS
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk1.8.0_171/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid27324.log
error:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)
at org.elasticsearch.tools.launchers.JvmOption.flagsFinal(JvmOption.java:119)
at org.elasticsearch.tools.launchers.JvmOption.findFinalOptions(JvmOption.java:81)
at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:38)
at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:135)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
해결 방법:config 디렉터리의 프로필 jvm를 수정합니다.options
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## and the min and max should be set to the same value. For
## example, to set the heap to 4 GB, create a new file in the
## jvm.options.d directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
#
-Xms128m
-Xmx128m
[2021-04-09T10:26:01,627][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [izwz9ja3exxb7by25st5gbz] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116) ~[elasticsearch-cli-7.12.0.jar:7.12.0]
at org.elasticsearch.cli.Command.main(Command.java:79) ~[elasticsearch-cli-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81) ~[elasticsearch-7.12.0.jar:7.12.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:101) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:168) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397) ~[elasticsearch-7.12.0.jar:7.12.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.12.0.jar:7.12.0]
... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:101)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:168)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:397)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:75)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:116)
at org.elasticsearch.cli.Command.main(Command.java:79)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:81)
For complete error details, refer to the log at /root/elasticsearch-7.12.0/logs/elasticsearch.log
해결 방법:es 사용자 만들기
es
useradd es
es changeme
passwd es
es
chown -R es elasticsearch-7.12.0
es
su es
."Error: Could not find or load main class org.elasticsearch.tools.java_version_checker.JavaVersionChecker"해결 방법:elasticsearch 디렉터리가 루트 아래에 있기 때문에elasticsearch 설치 파일을 es 사용자 디렉터리로 복사합니다
."AccessDeniedException[/home/es/elasticsearch-7.12.0/config/elasticsearch.yml]"해결 방법을 시작합니다. elasticsearch 디렉터리에 권한이 없어서 프로필을 읽을 수 없습니다. 권한을 부여받아 조작하십시오
chown -R es elasticsearch-7.12.0
."ERROR:[2]bootstrap checks failed"[1]: max file descriptors[4096] for elasticsearch process is too low, increase to atleast[65535]:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
해결 방법:
vim /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
kafka connect e elasticsearch를 관찰할 수 있습니다.No menu lateral do dashboard tem a opção de connectors onde ele mostra todos os clusters do kafka connect conectados atu...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.