- 单节点安装
- 上传安装包到相应目录
- 解压安装包 tar -zxvf elasticsearch-6.1.1.tar.gz -C /export/servers
- 在/export/data目录下创建两个文件夹
- mkdir data
- mkdir logs
- 进入到es文件目录下的config进行修改配置文件
- cd /export/servers/elasticsearch/config
- vi elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------
cluster.name: my-es
# ------------------------------------ Node ------------------------------------
node.name: node-001
# ----------------------------------- Paths ------------------------------------
path.data: /export/data/es/data
path.logs: /export/data/es/logs
# ----------------------------------- Memory -----------------------------------
#bootstrap.memory_lock: true
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
# ---------------------------------- Network -----------------------------------
network.host: 192.168.229.131
http.port: 9200
# --------------------------------- Discovery ----------------------------------
discovery.zen.ping.unicast.hosts: ["node-001"]
- vi /etc/security/limits.conf
把这些插入到最后
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
- vi /etc/security/limits.d/90-nproc.conf
把
* soft nproc 1024
修改为
* soft nproc 4096
- vi /etc/sysctl.conf
在最后插入
vm.max_map_count=655360- 执行命令
- sudo sysctl -p
- 启动报错
[2018-08-07T11:35:38,055][INFO ][o.e.n.Node ] [node-001] initializing ...
[2018-08-07T11:35:38,130][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-001] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.1.1.jar:6.1.1]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.1.1.jar:6.1.1]
Caused by: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:266) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.1.jar:6.1.1]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /export/data/es/data/nodes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_65]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_65]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_65]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:204) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.node.Node.<init>(Node.java:263) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:322) ~[elasticsearch-6.1.1.jar:6.1.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.1.1.jar:6.1.1]
... 6 more
- 解决办法
chown -R es:es /export/data/es
chown -R es:es /export/data/es/data
chown -R es:es /export/data/es/logs
- 解决办法
- 启动报错
main ERROR RollingFileManager (/usr/local/software/elasticsearch-5.5.2/logs/elasticsearch.log)
java.io.FileNotFoundException: /usr/local/software/elasticsearch-5.5.2/logs/elasticsearch.log
(Permission denied) java.io.FileNotFoundException: /usr/local/software/elasticsearch-5.5.2/logs/elasticsearch.log (Permission denied)
- 解决办法
用chgrp和chown 用户 /export/data/es/logs/文件 分别对每个文件进行授权
例:
chgrp es my-es_index_search_slowlog.log
chown es my-es_index_search_slowlog.log
- 解决办法
- 启动成功(必须新建用户,不能用root用户进行启动)
[es@node-001 elasticsearch]$ bin/elasticsearch
控制台出现
[2018-08-07T13:08:44,709][INFO ][o.e.n.Node ] [node-001] initializing ...
[2018-08-07T13:08:44,913][INFO ][o.e.e.NodeEnvironment ] [node-001] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [10.2gb], net total_space [17.1gb], types [rootfs]
[2018-08-07T13:08:44,915][INFO ][o.e.e.NodeEnvironment ] [node-001] heap size [1015.6mb], compressed ordinary object pointers [true]
[2018-08-07T13:08:44,920][INFO ][o.e.n.Node ] [node-001] node name [node-001], node ID [66uOsF-VTjiy8jto6pa1HA]
[2018-08-07T13:08:44,921][INFO ][o.e.n.Node ] [node-001] version[6.1.1], pid[4181], build[bd92e7f/2017-12-17T20:23:25.338Z], OS[Linux/2.6.32-573.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_65/25.65-b01]
[2018-08-07T13:08:44,925][INFO ][o.e.n.Node ] [node-001] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/export/servers/elasticsearch, -Des.path.conf=/export/servers/elasticsearch/config]
[2018-08-07T13:08:47,359][INFO ][o.e.p.PluginsService ] [node-001] loaded module [aggs-matrix-stats]
[2018-08-07T13:08:47,363][INFO ][o.e.p.PluginsService ] [node-001] loaded module [analysis-common]
[2018-08-07T13:08:47,363][INFO ][o.e.p.PluginsService ] [node-001] loaded module [ingest-common]
[2018-08-07T13:08:47,363][INFO ][o.e.p.PluginsService ] [node-001] loaded module [lang-expression]
[2018-08-07T13:08:47,364][INFO ][o.e.p.PluginsService ] [node-001] loaded module [lang-mustache]
[2018-08-07T13:08:47,364][INFO ][o.e.p.PluginsService ] [node-001] loaded module [lang-painless]
[2018-08-07T13:08:47,365][INFO ][o.e.p.PluginsService ] [node-001] loaded module [mapper-extras]
[2018-08-07T13:08:47,365][INFO ][o.e.p.PluginsService ] [node-001] loaded module [parent-join]
[2018-08-07T13:08:47,366][INFO ][o.e.p.PluginsService ] [node-001] loaded module [percolator]
[2018-08-07T13:08:47,366][INFO ][o.e.p.PluginsService ] [node-001] loaded module [reindex]
[2018-08-07T13:08:47,366][INFO ][o.e.p.PluginsService ] [node-001] loaded module [repository-url]
[2018-08-07T13:08:47,367][INFO ][o.e.p.PluginsService ] [node-001] loaded module [transport-netty4]
[2018-08-07T13:08:47,367][INFO ][o.e.p.PluginsService ] [node-001] loaded module [tribe]
[2018-08-07T13:08:47,371][INFO ][o.e.p.PluginsService ] [node-001] no plugins loaded
[2018-08-07T13:08:51,886][INFO ][o.e.d.DiscoveryModule ] [node-001] using discovery type [zen]
[2018-08-07T13:08:53,369][INFO ][o.e.n.Node ] [node-001] initialized
[2018-08-07T13:08:53,370][INFO ][o.e.n.Node ] [node-001] starting ...
[2018-08-07T13:08:53,732][INFO ][o.e.t.TransportService ] [node-001] publish_address {192.168.229.131:9300}, bound_addresses {192.168.229.131:9300}
[2018-08-07T13:08:53,768][INFO ][o.e.b.BootstrapChecks ] [node-001] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2018-08-07T13:08:56,923][INFO ][o.e.c.s.MasterService ] [node-001] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {node-001}{66uOsF-VTjiy8jto6pa1HA}{s_GF_-w-RBSrESUyW4dH2g}{192.168.229.131}{192.168.229.131:9300}
[2018-08-07T13:08:56,937][INFO ][o.e.c.s.ClusterApplierService] [node-001] new_master {node-001}{66uOsF-VTjiy8jto6pa1HA}{s_GF_-w-RBSrESUyW4dH2g}{192.168.229.131}{192.168.229.131:9300}, reason: apply cluster state (from master [master {node-001}{66uOsF-VTjiy8jto6pa1HA}{s_GF_-w-RBSrESUyW4dH2g}{192.168.229.131}{192.168.229.131:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-08-07T13:08:57,040][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-001] publish_address {192.168.229.131:9200}, bound_addresses {192.168.229.131:9200}
[2018-08-07T13:08:57,040][INFO ][o.e.n.Node ] [node-001] started
[2018-08-07T13:08:57,073][INFO ][o.e.g.GatewayService ] [node-001] recovered [0] indices into cluster_state- http://node-001:9200/?pretty
- 页面显示
{
"name" : "node-001",
"cluster_name" : "my-es",
"cluster_uuid" : "Q4M7SdHCQHKPvD5lbChBhw",
"version" : {
"number" : "6.1.1",
"build_hash" : "bd92e7f",
"build_date" : "2017-12-17T20:23:25.338Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Elasticsearch的安装
最新推荐文章于 2022-07-18 22:42:15 发布