摘要:安裝環境這里使用方式安裝,前提是必須有網絡安裝完成,查看版本安裝的安裝很簡單,下載下來解壓即可,這里使用下載,當然也可通過網頁下載,再拷貝。
安裝java環境
這里使用yum方式安裝,前提是必須有網絡
yum install java-1.8.0-openjdk
安裝完成,查看java版本
[root@localhost ~]# java -version openjdk version "1.8.0_151" OpenJDK Runtime Environment (build 1.8.0_151-b12) OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)安裝 Elasticsearch
Elasticsearch的安裝很簡單,下載下來解壓即可,這里使用wget下載,當然也可通過網頁下載 https://www.elastic.co/downlo... ,再拷貝。
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz
解壓到/usr/local/
tar -zxvf elasticsearch-5.6.3.tar.gz -C /usr/local/運行Elasticsearch
Elasticsearch 要求不能使用超級用戶root運行,所以我們建立一個testuser賬號
# 創建testuser賬戶 adduser testuser # 修改密碼 passwd testuser
然后,給testuser用戶elasticsearch目錄的授權。
chown -R testuser /usr/local/elasticsearch-5.6.3/
切換至elasticsearch目錄,并以testuser用戶運行
cd /usr/local/elasticsearch-5.6.3/ su testuser
運行elasticsearch,如果想后臺運行后面加 -d
[testuser@localhost elasticsearch-5.6.3]$ ./bin/elasticsearch [2017-10-31T16:07:09,445][INFO ][o.e.n.Node ] [] initializing ... [2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment ] [oDFU6c3] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [45.4gb], net total_space [49.9gb], spins? [unknown], types [rootfs] [2017-10-31T16:07:09,662][INFO ][o.e.e.NodeEnvironment ] [oDFU6c3] heap size [1.9gb], compressed ordinary object pointers [true] [2017-10-31T16:07:09,663][INFO ][o.e.n.Node ] node name [oDFU6c3] derived from node ID [oDFU6c3UT6ORC2p0CKBeLA]; set [node.name] to override [2017-10-31T16:07:09,663][INFO ][o.e.n.Node ] version[5.6.3], pid[11484], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_151/25.151-b12] [2017-10-31T16:07:09,664][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/local/elasticsearch-5.6.3] [2017-10-31T16:07:10,723][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [aggs-matrix-stats] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [ingest-common] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-expression] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-groovy] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-mustache] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [lang-painless] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [parent-join] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [percolator] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [reindex] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [transport-netty3] [2017-10-31T16:07:10,724][INFO ][o.e.p.PluginsService ] [oDFU6c3] loaded module [transport-netty4] [2017-10-31T16:07:10,725][INFO ][o.e.p.PluginsService ] [oDFU6c3] no plugins loaded [2017-10-31T16:07:12,622][INFO ][o.e.d.DiscoveryModule ] [oDFU6c3] using discovery type [zen] [2017-10-31T16:07:13,133][INFO ][o.e.n.Node ] initialized [2017-10-31T16:07:13,133][INFO ][o.e.n.Node ] [oDFU6c3] starting ... [2017-10-31T16:07:13,306][INFO ][o.e.t.TransportService ] [oDFU6c3] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2017-10-31T16:07:13,318][WARN ][o.e.b.BootstrapChecks ] [oDFU6c3] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536] [2017-10-31T16:07:16,372][INFO ][o.e.c.s.ClusterService ] [oDFU6c3] new_master {oDFU6c3}{oDFU6c3UT6ORC2p0CKBeLA}{olaY-n5LTpCUpzrhU3joVw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-10-31T16:07:16,398][INFO ][o.e.h.n.Netty4HttpServerTransport] [oDFU6c3] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200} [2017-10-31T16:07:16,399][INFO ][o.e.n.Node ] [oDFU6c3] started [2017-10-31T16:07:17,242][INFO ][o.e.g.GatewayService ] [oDFU6c3] recovered [0] indices into cluster_state
如果沒有沒有error,就運行成功啦
新開一個終端,用curl訪問
[root@localhost ~]# curl "http://localhost:9200/?pretty" { "name" : "oDFU6c3", "cluster_name" : "elasticsearch", "cluster_uuid" : "v2mGsAuuTsqIzzm8CZcW5w", "version" : { "number" : "5.6.3", "build_hash" : "1a2f265", "build_date" : "2017-10-06T20:33:39.012Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search" }其他配置
elasticsearch指定ip地址
編輯es的配置文件
[testuser@localhost elasticsearch-5.6.3]$ vim ./config/elasticsearch.yml
找到network.host: 一行,去除#號,修改為:
network.host: [_local_, 172.30.6.1]
172.30.6.1為指定的ip地址,可以是多個。
這樣就可以在瀏覽器里打開啦
http://172.30.6.1:9200/?pretty
可能遇到的問題max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
max_map_count 的值是指一個進程最多可用于的內存映射區(memory map areas),在調用malloc會用到,由mmap/mprotect生成。
解決辦法:
切換到root用戶修改配置/etc/sysctl.conf
su root vim /etc/sysctl.conf
加入
vm.max_map_count=655360
然后使其生效
sysctl -p
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
文件描述符太低
解決辦法:
切換到root用戶修改/etc/security/limits.conf
su root vim /etc/security/limits.conf
加入
* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
使用supervisor啟動時,查看日志仍然報下面的錯誤
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
解決辦法:
切換到root用戶修改vim /etc/supervisord.d/elasticsearch.conf
[supervisord] minfds=65536 minprocs=32768 [program:es] process_name=%(program_name)s_%(process_num)02d directory=/usr/local/elasticsearch-5.6.3/ command=/usr/local/elasticsearch-5.6.3/bin/elasticsearch ;autostart=true autorestart=false user=testuser numprocs=1
原文 https://www.tech1024.cn/origi...
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/26054.html
閱讀 2513·2023-04-25 17:27
閱讀 1824·2019-08-30 15:54
閱讀 2369·2019-08-30 13:06
閱讀 2980·2019-08-30 11:04
閱讀 746·2019-08-29 15:30
閱讀 729·2019-08-29 15:16
閱讀 1733·2019-08-26 10:10
閱讀 3603·2019-08-23 17:02