ELK 實驗(二)安裝Elastic Search 單節點
java -version
echo $JAVA_HOME
木有返回,環境沒有設置好。。。
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_162
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
刷新下
source /etc/profile
有了
下載
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz
tar -zxvf elasticsearch-6.2.3.tar.gz
cd elasticsearch-6.2.3/bin
./elasticsearch
容我修個錯誤
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
這個錯誤,是因為使用root用戶啟動elasticsearch,elasticsearch是不允許使用root用戶啟動的,所以我們需要添加用戶,或者加一個參數。
cp -r elasticsearch-6.2.3 /usr/
su pactera
./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/elasticsearch-6.2.3/config/jvm.options
容我再修個錯誤
感覺目錄沒權限,加一個
chown pactera /usr/elasticsearch-6.2.3/ -R
chown -R 文件夾名 用戶名
內存設置小了,不過可以忽略
ES5之前可以用這個,6就不行了
vi bin/elasticsearch
ES_JAVA_OPTS="-Des.insecure.allow.root=true"
或者啟動加參數
./elasticsearch -Des.insecure.allow.root=true
以後臺服務運行
./elasticsearch -d
curl -i localhost:9200
本地訪問有數據,但是遠程訪問無法,容我修個錯誤
vi config/elasticsearch.yml
network.host: 0.0.0.0
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
又出現3個錯誤,繼續踩坑
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vi config/jvm.options
加大到2g
增加10倍總歸沒錯了吧
sysctl -w vm.max_map_count=655360
sysctl -a | grep "vm.max_map_count"
vi /etc/security/limits.conf
# allow user ‘pactera‘ mlockall
pactera soft memlock unlimited
pactera hard memlock unlimited
* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
如果需要指定用戶用用戶代替*
pactera soft nofile 65536
pactera hard nofile 65536
最後的錯誤
bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/bootstrap-checks.html
綁定127.0.0.1即可
windows 安裝
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.msi
這組件十分的傻瓜。。。。
ELK 實驗(二)安裝Elastic Search 單節點