码迷,mamicode.com
首页 > 其他好文 > 详细

elastic

时间:2019-09-25 17:34:25      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:command   min   tcp   about   big   size   mamicode   extra   bootstrap   

安装elastic

下载

Elasticsearch 6.3.1 | Elastic

技术图片

解压

[root@192 modules]# tar -zxvf elasticsearch-6.3.1.tar.gz

启动

报错一

elasticsearch 为了安全性默认不允许root 用户来启动

[root@192 elasticsearch-6.3.1]# cd bin/
[root@192 bin]# ./elasticsearch
[2019-07-08T08:45:49,312][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] 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:140) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.1.jar:6.3.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:104) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.1.jar:6.3.1]
    ... 6 more

新建立es用户

[root@192 bin]# useradd es
[root@192 bin]# pwd
/opt/modules/elasticsearch-6.3.1/bin
[root@192 bin]# cd
[root@192 ~]# pwd
/root
[root@192 ~]# cd /opt/modules/elasticsearch-6.3.1
[root@192 elasticsearch-6.3.1]# ll
total 460
drwxr-xr-x.  3 root root   4096 Jul  8 08:43 bin
drwxr-xr-x.  2 root root   4096 Jul  8 08:45 config
drwxr-xr-x.  2 root root   4096 Jun 30  2018 lib
-rw-r--r--.  1 root root  13675 Jun 30  2018 LICENSE.txt
drwxr-xr-x.  2 root root   4096 Jul  8 08:45 logs
drwxr-xr-x. 17 root root   4096 Jun 30  2018 modules
-rw-r--r--.  1 root root 416018 Jun 30  2018 NOTICE.txt
drwxr-xr-x.  2 root root   4096 Jun 30  2018 plugins
-rw-r--r--.  1 root root   8511 Jun 30  2018 README.textile

报错二

授权、启动

[root@192 elasticsearch-6.3.1]# chown -R es:es ./
[root@192 elasticsearch-6.3.1]# ll
total 460
drwxr-xr-x.  3 es es   4096 Jul  8 08:43 bin
drwxr-xr-x.  2 es es   4096 Jul  8 08:45 config
drwxr-xr-x.  2 es es   4096 Jun 30  2018 lib
-rw-r--r--.  1 es es  13675 Jun 30  2018 LICENSE.txt
drwxr-xr-x.  2 es es   4096 Jul  8 08:45 logs
drwxr-xr-x. 17 es es   4096 Jun 30  2018 modules
-rw-r--r--.  1 es es 416018 Jun 30  2018 NOTICE.txt
drwxr-xr-x.  2 es es   4096 Jun 30  2018 plugins
-rw-r--r--.  1 es es   8511 Jun 30  2018 README.textile
[root@192 elasticsearch-6.3.1]# su es
[es@192 elasticsearch-6.3.1]$ ./bin/elasticsearch
[2019-07-08T08:48:42,989][WARN ][o.e.b.JNANatives         ] unable to install syscall filter: 
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
    at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:341) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:616) ~[elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:258) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:109) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:171) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.3.1.jar:6.3.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) [elasticsearch-6.3.1.jar:6.3.1]

解决

进入/opt/modules/elasticsearch-6.3.1/config目录,修改配置文件 elasticsearch.yml,末尾追加

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

报错三

用户最大文件描述符限制低于 65536 而抛出的异常

用户最大的线程数限制低于 4096 而抛出的异常

系统最大虚拟内存低于 262144 而抛出的异常

[es@192 elasticsearch-6.3.1]$ ./bin/elasticsearch
[2019-07-08T08:56:38,934][INFO ][o.e.n.Node               ] [] initializing ...
[2019-07-08T08:56:39,016][INFO ][o.e.e.NodeEnvironment    ] [zzp49gD] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [9.2gb], net total_space [14.6gb], types [rootfs]
[2019-07-08T08:56:39,016][INFO ][o.e.e.NodeEnvironment    ] [zzp49gD] heap size [989.8mb], compressed ordinary object pointers [true]
[2019-07-08T08:56:39,017][INFO ][o.e.n.Node               ] [zzp49gD] node name derived from node ID [zzp49gDDT1yAkU_sqvvLdw]; set [node.name] to override
[2019-07-08T08:56:39,018][INFO ][o.e.n.Node               ] [zzp49gD] version[6.3.1], pid[3815], build[default/tar/eb782d0/2018-06-29T21:59:26.107521Z], OS[Linux/2.6.32-642.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_202/25.202-b08]
[2019-07-08T08:56:39,018][INFO ][o.e.n.Node               ] [zzp49gD] 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, -Djava.io.tmpdir=/tmp/elasticsearch.KQ6g6BOC, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/opt/modules/elasticsearch-6.3.1, -Des.path.conf=/opt/modules/elasticsearch-6.3.1/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-07-08T08:56:40,833][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [aggs-matrix-stats]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [analysis-common]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [ingest-common]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [lang-expression]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [lang-mustache]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [lang-painless]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [mapper-extras]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [parent-join]
[2019-07-08T08:56:40,834][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [percolator]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [rank-eval]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [reindex]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [repository-url]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [transport-netty4]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [tribe]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-core]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-deprecation]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-graph]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-logstash]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-ml]
[2019-07-08T08:56:40,835][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-monitoring]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-rollup]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-security]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-sql]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-upgrade]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] loaded module [x-pack-watcher]
[2019-07-08T08:56:40,836][INFO ][o.e.p.PluginsService     ] [zzp49gD] no plugins loaded
[2019-07-08T08:56:43,471][INFO ][o.e.x.s.a.s.FileRolesStore] [zzp49gD] parsed [0] roles from file [/opt/modules/elasticsearch-6.3.1/config/roles.yml]
[2019-07-08T08:56:43,817][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/3894] [Main.cc@109] controller (64 bit): Version 6.3.1 (Build 4d0b8f0a0ef401) Copyright (c) 2018 Elasticsearch BV
[2019-07-08T08:56:44,114][DEBUG][o.e.a.ActionModule       ] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-07-08T08:56:44,331][INFO ][o.e.d.DiscoveryModule    ] [zzp49gD] using discovery type [zen]
[2019-07-08T08:56:45,016][INFO ][o.e.n.Node               ] [zzp49gD] initialized
[2019-07-08T08:56:45,016][INFO ][o.e.n.Node               ] [zzp49gD] starting ...
[2019-07-08T08:56:45,173][INFO ][o.e.t.TransportService   ] [zzp49gD] publish_address {192.168.1.101:9300}, bound_addresses {192.168.1.101:9300}
[2019-07-08T08:56:45,196][INFO ][o.e.b.BootstrapChecks    ] [zzp49gD] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-07-08T08:56:45,223][INFO ][o.e.n.Node               ] [zzp49gD] stopping ...
[2019-07-08T08:56:45,295][INFO ][o.e.n.Node               ] [zzp49gD] stopped
[2019-07-08T08:56:45,295][INFO ][o.e.n.Node               ] [zzp49gD] closing ...
[2019-07-08T08:56:45,307][INFO ][o.e.n.Node               ] [zzp49gD] closed
[2019-07-08T08:56:45,313][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started

解决户最大文件描述符限制低于 65536 而抛出的异常

切换到root用户,进入/etc/security/目录,修改limits.conf文件,末尾追加

* hard nofile 65536
* soft nofile 131072
* hard nproc  4096
* soft nproc  2048

解决用户最大的线程数限制低于 4096 而抛出的异常

切换到root用户,进入/etc/security/limits.d目录,修改90-nproc.conf文件

*          soft    nproc     4096
root       soft    nproc     unlimited

解决系统最大虚拟内存低于 262144 而抛出的异常

修改/etc/sysctl.conf文件,末尾追加

vm.max_map_count=655360
fs.file-max=655360

配置访问地址

进入/opt/modules/elasticsearch-6.3.1/config目录,修改elasticsearch.yml文件

技术图片

访问

[es@192 elasticsearch-6.3.1]$ curl http://192.168.1.101:9200
{
  "name" : "zzp49gD",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "i0I9Oc2gQxOkc-jk4ZvEvw",
  "version" : {
    "number" : "6.3.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "eb782d0",
    "build_date" : "2018-06-29T21:59:26.107521Z",
    "build_snapshot" : false,
    "lucene_version" : "7.3.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
[es@192 elasticsearch-6.3.1]$ 

技术图片

安装kibana

下载

Kibana 6.3.1 | Elastic

技术图片

解压

[root@192 bin]# tar -zxvf kibana-6.3.1-linux-x86_64.tar.gz 

修改配置文件

进入

[root@192 bin]# cd kibana-6.3.1-linux-x86_64/config/

修改kibana.yml配置文件

技术图片

启动

[root@192 bin]# pwd
/opt/modules/kibana-6.3.1-linux-x86_64/bin
[root@192 bin]# nohup ./kibana &
[1] 3665
[root@192 bin]# nohup: ignoring input and appending output to `nohup.out'

[root@192 bin]# ps -ef | grep node
root       3665   3615 51 08:45 pts/0    00:00:25 ./../node/bin/node --no-warnings ./../src/cli
root       3685   3615  0 08:46 pts/0    00:00:00 grep node

访问

技术图片

技术图片

操作es增删改查

ES 简单操作 - ELK - Wiki.Shileizcc.com

PUT /movie_index/movie/1
{
  "id":1,
  "name":"operation red sea",
  "doubanscore":8.5,
  "actorList":[
    {
      "id":1,"name":"zhang yi"
    },
    {
      "id":2,"name":"hai qing"
    },
    {
      "id":3,"name":"zhang han yu"
    }
    
    ]
}

DELETE /movie_index/movie/1

和新增一样,PUT既可以新增,也可以修改

PUT /movie_index/movie/1
{
  "id":2,
  "name":"operation red sea",
  "doubanscore":8.5,
  "actorList":[
    {
      "id":1,"name":"zhang yi"
    },
    {
      "id":2,"name":"hai qing"
    },
    {
      "id":3,"name":"zhang han yu"
    }
    
    ]
}

GET /movie_index/_search

安装分词器analysis-ik

下载

Release v6.3.1 · medcl/elasticsearch-analysis-ik

技术图片

解压、上传

技术图片

[root@192 ~]# cd /opt/modules/elasticsearch-6.3.1/plugins/
[root@192 plugins]# ll
total 4
drwxr-xr-x. 3 root root 4096 Jul 10 08:51 elasticsearch-analysis-ik-6.3.1
[root@192 plugins]# 

重启es

[root@192 bin]# su es
[es@192 bin]$ nohup ./elasticsearch &
[1] 4002
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef|grep elastic
es         4002   3987 99 08:45 pts/0    00:00:25 /usr/java/jdk1.8.0_202-amd64/bin/java -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 -Djava.io.tmpdir=/tmp/elasticsearch.iMX34Qx6 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/opt/modules/elasticsearch-6.3.1 -Des.path.conf=/opt/modules/elasticsearch-6.3.1/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /opt/modules/elasticsearch-6.3.1/lib/* org.elasticsearch.bootstrap.Elasticsearch
es         4081   4002  0 08:45 pts/0    00:00:00 /opt/modules/elasticsearch-6.3.1/modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller
es         4092   3987  0 08:45 pts/0    00:00:00 grep elastic
[es@192 bin]$ kill -9 4002
[es@192 bin]$ ps -ef|grep elastic
es         4235   3987  0 08:54 pts/0    00:00:00 grep elastic
[2]+  Killed                  nohup ./kibana
[es@192 bin]$ cd /opt/modules/elasticsearch-6.3.1/bin/
[es@192 bin]$ nohup ./elasticsearch &
[1] 4238
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef|grep elastic
es         4238   3987 99 08:54 pts/0    00:00:15 /usr/java/jdk1.8.0_202-amd64/bin/java -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 -Djava.io.tmpdir=/tmp/elasticsearch.zw6LMXqV -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/opt/modules/elasticsearch-6.3.1 -Des.path.conf=/opt/modules/elasticsearch-6.3.1/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /opt/modules/elasticsearch-6.3.1/lib/* org.elasticsearch.bootstrap.Elasticsearch
es         4317   4238  0 08:54 pts/0    00:00:00 /opt/modules/elasticsearch-6.3.1/modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller
es         4325   3987  0 08:54 pts/0    00:00:00 grep elastic
[es@192 bin]$ cd /opt/modules/kibana-6.3.1-linux-x86_64/bin/
[es@192 bin]$ nohup  ./kibana &
[2] 4384
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef|grep node
es         4384   3987 77 08:55 pts/0    00:00:06 ./../node/bin/node --no-warnings ./../src/cli
es         4396   3987  0 08:55 pts/0    00:00:00 grep node

重启kibana

[es@192 bin]$ cd /opt/modules/kibana-6.3.1-linux-x86_64/bin/
[es@192 bin]$ nohup ./kibana &
[2] 4155
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef|grep node
es         4155   3987 56 08:46 pts/0    00:00:04 ./../node/bin/node --no-warnings ./../src/cli
es         4167   3987  0 08:46 pts/0    00:00:00 grep node
[es@192 bin]$ kill -9 4155
[es@192 bin]$ ps -ef|grep node
es         4237   3987  0 08:54 pts/0    00:00:00 grep node



访问es

技术图片

访问kibana

入分词器前

技术图片

加入分词器后

简易分词器

技术图片

技术图片

尽最大可能分词器

技术图片

技术图片

es集群

克隆

克隆一个已经安装好elastic、kibana、analysis-ik的机器

虚拟机----快照---拍摄快照

技术图片

虚拟机---管理---克隆---现有快照

技术图片

技术图片

技术图片

修改IP

修改克隆后机器102的主机名、IP地址、硬件Mac地址

参考

虚拟机配置静态ip | 小兵兵

集群配置es

修改配置文件

修改101机器

进入/opt/modules/elasticsearch-6.3.1/config目录,修改elasticsearch.yml配置文件

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- 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):
#
node.master: true
node.data: true
path.data: /opt/data
#
# Path to log files:
#
path.logs: /opt/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# 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):
#
network.host: 192.168.1.101
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300
#
# 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]"]
#
discovery.zen.ping.unicast.hosts: ["192.168.1.102"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# 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

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

建立数据存储目录、日志目录

[root@192 config]# cd /opt/
[root@192 opt]# mkdir data
[root@192 opt]# mkdir logs
[root@192 opt]# ll
total 16
drwxr-xr-x. 2 root root 4096 Jul 10 09:58 data
drwxr-xr-x. 2 root root 4096 Jul 10 09:58 logs
drwxr-xr-x. 4 root root 4096 Jul  9 08:42 modules
drwxr-xr-x. 2 root root 4096 Mar 26  2015 rh
[root@192 opt]# chown es:es -R data/ logs/
[root@192 opt]# ll
total 16
drwxr-xr-x. 2 es   es   4096 Jul 10 09:58 data
drwxr-xr-x. 2 es   es   4096 Jul 10 09:58 logs
drwxr-xr-x. 4 root root 4096 Jul  9 08:42 modules
drwxr-xr-x. 2 root root 4096 Mar 26  2015 rh

修改102机器

进入/opt/modules/elasticsearch-6.3.1/config目录,修改elasticsearch.yml配置文件

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-2
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
node.master: true
node.data: true
path.data: /opt/data
#
# Path to log files:
#
path.logs: /opt/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# 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):
#
network.host: 192.168.1.102
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300
#
# 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]"]
#
discovery.zen.ping.unicast.hosts: ["192.168.1.101"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
#
# 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

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

建立数据存储目录、日志目录

[root@192 config]# cd /opt/
[root@192 opt]# mkdir data
[root@192 opt]# mkdir logs
[root@192 opt]# ll
total 16
drwxr-xr-x. 2 root root 4096 Jul 10 09:58 data
drwxr-xr-x. 2 root root 4096 Jul 10 09:58 logs
drwxr-xr-x. 4 root root 4096 Jul  9 08:42 modules
drwxr-xr-x. 2 root root 4096 Mar 26  2015 rh
[root@192 opt]# chown es:es -R data/ logs/
[root@192 opt]# ll
total 16
drwxr-xr-x. 2 es   es   4096 Jul 10 09:58 data
drwxr-xr-x. 2 es   es   4096 Jul 10 09:58 logs
drwxr-xr-x. 4 root root 4096 Jul  9 08:42 modules
drwxr-xr-x. 2 root root 4096 Mar 26  2015 rh

重启

重启101机器

[es@192 bin]$ pwd
/opt/modules/elasticsearch-6.3.1/bin
[es@192 bin]$ ps -ef | grep elastic
es         3795   3638  0 10:08 pts/0    00:00:00 grep elastic
[1]+  Killed                  nohup ./elasticsearch
[es@192 bin]$ nohup ./elasticsearch &
[1] 3796
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef | grep elastic
es         3796   3638 99 10:09 pts/0    00:00:07 /usr/java/jdk1.8.0_202-amd64/bin/java -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 -Djava.io.tmpdir=/tmp/elasticsearch.wZB2cw0p -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/opt/modules/elasticsearch-6.3.1 -Des.path.conf=/opt/modules/elasticsearch-6.3.1/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /opt/modules/elasticsearch-6.3.1/lib/* org.elasticsearch.bootstrap.Elasticsearch
es         3875   3796  0 10:09 pts/0    00:00:00 /opt/modules/elasticsearch-6.3.1/modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller
es         3881   3638  0 10:09 pts/0    00:00:00 grep elastic

重启102机器

[es@192 bin]$ pwd
/opt/modules/elasticsearch-6.3.1/bin
[es@192 bin]$ ps -ef|grep elastic
es         4284   3992  0 10:10 pts/1    00:00:00 grep elastic
[es@192 bin]$ nohup ./elasticsearch &
[1] 4285
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

[es@192 bin]$ ps -ef|grep elastic
es         4285   3992 99 10:10 pts/1    00:00:04 /usr/java/jdk1.8.0_202-amd64/bin/java -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 -Djava.io.tmpdir=/tmp/elasticsearch.JmqOtV9r -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/opt/modules/elasticsearch-6.3.1 -Des.path.conf=/opt/modules/elasticsearch-6.3.1/config -Des.distribution.flavor=default -Des.distribution.type=tar -cp /opt/modules/elasticsearch-6.3.1/lib/* org.elasticsearch.bootstrap.Elasticsearch
es         4364   4285  0 10:10 pts/1    00:00:00 /opt/modules/elasticsearch-6.3.1/modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller
es         4370   3992  0 10:10 pts/1    00:00:00 grep elastic
[es@192 bin]$ ll

访问

访问101机器

技术图片

访问102机器

技术图片

集群管理工具cerebro

插件【head,bigdesk,cerebro[kopf]】安装

下载

Releases · lmenezes/cerebro

技术图片

上传、解压

技术图片

[root@192 modules]# cd /opt/
[root@192 opt]# mkdir soft
[root@192 opt]# ll
total 20
drwxr-xr-x. 3 es   es   4096 Jul 10 10:01 data
drwxr-xr-x. 2 es   es   4096 Jul 10 10:01 logs
drwxr-xr-x. 4 root root 4096 Jul 10 10:23 modules
drwxr-xr-x. 2 root root 4096 Mar 26  2015 rh
drwxr-xr-x. 2 root root 4096 Jul 10 10:25 soft
[root@192 opt]# cd /opt/modules/
[root@192 modules]# ll
total 581928
-rw-r--r--.  1 root root  52397010 Jul 10 10:23 cerebro-0.8.3.tgz
drwxr-xr-x.  9 es   es        4096 Jul  9 17:16 elasticsearch-6.3.1
-rw-r--r--.  1 root root  91429350 Jul  8 08:42 elasticsearch-6.3.1.tar.gz
-rwxrwxrwx.  1 root root 178418154 Jul  7 21:08 jdk-8u202-linux-x64.rpm
drwxrwxr-x. 11 es   es        4096 Jun 30  2018 kibana-6.3.1-linux-x86_64
-rw-r--r--.  1 root root 205397076 Jul  8 08:42 kibana-6.3.1-linux-x86_64.tar.gz
-rw-r--r--.  1 root root  17855952 Jun  8 20:04 MySQL-client-5.5.48-1.linux2.6.x86_64.rpm
-rw-r--r--.  1 root root  50372369 Jun  8 20:24 MySQL-server-5.5.48-1.linux2.6.x86_64.rpm
[root@192 modules]# tar -zxvf cerebro-0.8.3.tgz -C /opt/soft/

启动

[root@192 modules]# cd /opt/soft/
[root@192 soft]# ll
total 4
drwxr-xr-x. 5 503 games 4096 Apr  5 16:48 cerebro-0.8.3
[root@192 soft]# cd cerebro-0.8.3/
[root@192 cerebro-0.8.3]# cd bin/
[root@192 bin]# ll
total 20
-rwxr-xr-x. 1 503 games 9497 Apr  5 16:48 cerebro
-rwxr-xr-x. 1 503 games 4970 Apr  5 16:48 cerebro.bat
[root@192 bin]# nohup ./cerebro &
[1] 4030
[root@192 bin]# nohup: ignoring input and appending output to `nohup.out'

访问

技术图片

技术图片

测试

建立一条数据

启动kibana,访问添加数据

[root@192 modules]# cd /opt/modules/kibana-6.3.1-linux-x86_64/bin/
[root@192 bin]# ll
total 948
-rwxr-xr-x. 1 es es    632 Jun 30  2018 kibana
-rwxr-xr-x. 1 es es    588 Jun 30  2018 kibana-keystore
-rwxr-xr-x. 1 es es    639 Jun 30  2018 kibana-plugin
-rw-------. 1 es es 952696 Jul 10 09:17 nohup.out
[root@192 bin]# su es
[es@192 bin]$ nohup ./kibana &
[1] 4434
[es@192 bin]$ nohup: ignoring input and appending output to `nohup.out'

技术图片

cerebro管理工具查看

技术图片

elastic

标签:command   min   tcp   about   big   size   mamicode   extra   bootstrap   

原文地址:https://www.cnblogs.com/lisingshen/p/11586089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!