日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux安装elasticsearch5.5

發布時間:2023/12/10 linux 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux安装elasticsearch5.5 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

大家好,我是烤鴨:

我是采用官網下載tar包的方式安裝的。

安裝環境:centos 7.2,jdk1.8

下載地址:
https://www.elastic.co/downloads/elasticsearch
1.解壓縮:
解壓 elasticsearch.5.5.2.tar.gz

tar -zxvf elasticsearch-5.2.2.tar.gz
2.創建用戶:
因為Elasticsearch5.0之后,不能使用root賬戶啟動,我們先創建一個elasticsearch組和賬戶

useradd elasticsearch -g elasticsearch -p elasticsearch chown -R elasticsearch:elasticsearch elasticsearch-5.2.2
3.修改配置文件:
貼一下我的elasticsearch.yml配置文件::

# ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # 集群名稱 cluster.name: my-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # 節點名稱 node.name: node-1 # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): #數據路徑(我是在elasticsearch的安裝目錄下新建了data文件夾) path.data: /usr/my/elasticsearch/elasticsearch-5.5.2/data # Path to log files: #日志路徑(我是在elasticsearch的安裝目錄下新建了logs文件夾) path.logs: /usr/my/elasticsearch/elasticsearch-5.5.2/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # # 當JVM開始寫入交換空間時(swapping)ElasticSearch性能會低下,你應該保證它不會寫入交換空間 # 設置這個屬性為true來鎖定內存,同時也要允許elasticsearch的進程可以鎖住內存,linux下可以通過 `ulimit -l unlimited` 命令 bootstrap.memory_lock: false # # Make sure that the heap size is set to about half the memory available # 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. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): #設置綁定的ip地址,可以是ipv4或ipv6的,默認為0.0.0.0 network.host: 0.0.0.0 # # Set a custom port for HTTP: # 設置對外服務的http端口,默認為9200 http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] #這是一個集群中的主節點的初始列表,當節點(主節點或者數據節點)啟動時使用這個列表進行探測 ["192.168.0.1(服務器ip):9300"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # 設置這個參數來保證集群中的節點可以知道其它N個有master資格的節點.默認為1,對于大的集群來說,可以設置大一點的值(2-4) discovery.zen.minimum_master_nodes: 1 # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true #開啟跨域訪問支持,默認為false http.cors.enabled: true #跨域訪問允許的域名地址,以上使用正則,(域名這里我替換了IP /http?:\/\/192.168.10.139(:[0-9]+)?/) http.cors.allow-origin: "*" 4.啟動
可以前臺啟動或者后臺啟動,進入elasticsearch目錄
前臺啟動:

./bin/elasticsearch 后臺啟動:(個人喜歡后臺啟動,啟動失敗可以logs下查看日志方便)

./bin/elasticsearch -d 按照以上配置,我的是可以正常啟動的。

另外說一下,防火墻,阿里云是有安全組配置的,如果不在安全組開放端口的話,服務器關閉防火墻也是沒用的。
貼一下centos 7.2,7.3關閉防火墻的命令:
關閉防火墻:

systemctl stop firewalld.service
關閉防火墻開機自啟動功能:

systemctl disable firewalld.service
出現以下命令,就啟動成功了:

[2017-09-20T10:36:10,400][INFO ][o.e.e.NodeEnvironment ] [node-1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [29.9gb], net total_space [39.2gb], spins? [unknown], types [rootfs] [2017-09-20T10:36:10,401][INFO ][o.e.e.NodeEnvironment ] [node-1] heap size [495.3mb], compressed ordinary object pointers [true] [2017-09-20T10:36:10,401][INFO ][o.e.n.Node ] [node-1] node name [node-1], node ID [uoi6ZmIbSNGu6xaol_OCpw] [2017-09-20T10:36:10,402][INFO ][o.e.n.Node ] [node-1] version[5.5.2], pid[9979], build[b2f0c09/2017-08-14T12:33:14.154Z], OS[Linux/3.10.0-514.26.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_144/25.144-b01] [2017-09-20T10:36:10,402][INFO ][o.e.n.Node ] [node-1] JVM arguments [-Xms512m, -Xmx512m, -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/my/elasticsearch/elasticsearch-5.5.2] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [aggs-matrix-stats] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [ingest-common] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-expression] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-groovy] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-mustache] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [lang-painless] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [parent-join] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [percolator] [2017-09-20T10:36:11,174][INFO ][o.e.p.PluginsService ] [node-1] loaded module [reindex] [2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService ] [node-1] loaded module [transport-netty3] [2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService ] [node-1] loaded module [transport-netty4] [2017-09-20T10:36:11,175][INFO ][o.e.p.PluginsService ] [node-1] no plugins loaded [2017-09-20T10:36:12,770][INFO ][o.e.d.DiscoveryModule ] [node-1] using discovery type [zen] [2017-09-20T10:36:13,234][INFO ][o.e.n.Node ] [node-1] initialized [2017-09-20T10:36:13,235][INFO ][o.e.n.Node ] [node-1] starting ... [2017-09-20T10:36:13,389][INFO ][o.e.t.TransportService ] [node-1] publish_address {172.17.214.191:9300}, bound_addresses {0.0.0.0:9300} [2017-09-20T10:36:13,398][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks [2017-09-20T10:36:16,446][INFO ][o.e.c.s.ClusterService ] [node-1] new_master {node-1}{uoi6ZmIbSNGu6xaol_OCpw}{kGPZi3xEREuq_Nb-s5yEKQ}{172.17.214.191}{172.17.214.191:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-09-20T10:36:16,469][INFO ][o.e.g.GatewayService ] [node-1] recovered [0] indices into cluster_state [2017-09-20T10:36:16,469][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-1] publish_address {172.17.214.191:9200}, bound_addresses {0.0.0.0:9200} [2017-09-20T10:36:16,469][INFO ][o.e.n.Node ] [node-1] started

訪問成功:


關于之前遇到的坑,也記錄一下:


1、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)


修改elasticsearch目錄中config/jvm.options
vim config/jvm.options
將原來的:

-Xms2g -Xmx2g 修改為:
-Xms512m -Xmx512m 2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
修改 /etc/security/limits.d/90-nproc.conf?
* soft nproc 1024 * soft nproc 2048 3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置文件,

cat /etc/sysctl.conf | grep vm.max_map_count vm.max_map_count=262144 如果不存在則添加

echo "vm.max_map_count=262144" >>/etc/sysctl.conf 4.uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];


修改elasticsearch下的config/elasticsearch.yml
這里的network.host原本寫的是服務器ip地址,
改成

network.host: 0.0.0.0 也有的說是,之前生成的結點數據沒有清除,
找到配置文件中的配置的結點目錄(path.data: /usr/my/elasticsearch/elasticsearch-5.5.2/dat)

清空原來的內容


5.[1] bootstrap checks failed
[1]: memory locking requested for elasticsearch process but memory is not locked
修改elasticsearch下的config/elasticsearch.yml
修改bootstrap.memory_lock:true

bootstrap.memory_lock: false


總結

以上是生活随笔為你收集整理的linux安装elasticsearch5.5的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。