Elasticsearch安装使用

1. 下载
[root@localhost src]#  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.12.tar.gz
2. 解压
 [root@localhost src]#  tar -zxvf elasticsearch-6.8.12.tar.gz
3. 移动到指定目录下
[root@localhost src]# mv elasticsearch-6.8.12 /opt/
[root@localhost src]# cd /opt/
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 8 631 503 143 8月  12 2020 elasticsearch-6.8.12

4. es只能在非root用户下启动

[root@localhost opt]# cd elasticsearch-6.8.12/
[root@localhost elasticsearch-6.8.12]# useradd es
[root@localhost elasticsearch-6.8.12]# passwd es
更改用户 ess 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost opt]# chown es -R elasticsearch-6.8.12/
[root@localhost opt]# ll
总用量 0
drwxr-xr-x. 8 es 503 143 8月  12 2020 elasticsearch-6.8.12
[root@localhost elasticsearch-6.8.12]# ll
总用量 460
drwxr-xr-x.  3 es 503   4096 7月  25 18:21 bin
drwxr-xr-x.  2 es 503    178 7月  25 19:10 config
drwxr-xr-x.  3 es 503   4096 7月  25 18:21 lib
-rw-r--r--.  1 es 503  13675 8月  12 2020 LICENSE.txt
drwxr-xr-x.  2 es 503    249 7月  25 19:05 logs
drwxr-xr-x. 31 es 503   4096 8月  12 2020 modules
-rw-r--r--.  1 es 503 427502 8月  12 2020 NOTICE.txt
drwxr-xr-x.  2 es 503      6 8月  12 2020 plugins
-rw-r--r--.  1 es 503   8534 8月  12 2020 README.textile

[root@localhost elasticsearch-6.8.12]# su es
[es@localhost elasticsearch-6.8.12]$ cd config/
[es@localhost config]$ ll
总用量 36
-rw-rw----. 1 es root   199 7月  25 19:05 elasticsearch.keystore
-rw-r-----. 1 es  503  2856 7月  25 19:03 elasticsearch.yml
-rw-r-----. 1 es  503  3885 8月  12 2020 jvm.options
-rw-r-----. 1 es  503 13085 8月  12 2020 log4j2.properties
-rw-r-----. 1 es  503   473 8月  12 2020 role_mapping.yml
-rw-r-----. 1 es  503   197 8月  12 2020 roles.yml
-rw-r-----. 1 es  503     0 8月  12 2020 users
-rw-r-----. 1 es  503     0 8月  12 2020 users_roles

5.修改JVM内存参数,不然可能启动不了,直接killed

[es@localhost config]$ vim jvm.options

[es@localhost config]$ cd ../
[es@localhost elasticsearch-6.8.12]$ cd bin/
[es@localhost bin]$ ./elasticsearch
[2021-07-25T20:05:33,036][INFO ][o.e.e.NodeEnvironment    ] [w32xLwK] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [1.8gb], net total_space [6.1gb], types [rootfs]
[2021-07-25T20:05:33,039][INFO ][o.e.e.NodeEnvironment    ] [w32xLwK] heap size [503.6mb], compressed ordinary object pointers [true]
[2021-07-25T20:05:33,040][INFO ][o.e.n.Node               ] [w32xLwK] node name derived from node ID [w32xLwKMRSiVRg42cdZ5kQ]; set [node.name] to override
[2021-07-25T20:05:33,041][INFO ][o.e.n.Node               ] [w32xLwK] version[6.8.12], pid[2925], build[default/tar/7a15d2a/2020-08-12T07:27:20.804867Z], OS[Linux/3.10.0-862.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
[2021-07-25T20:05:33,041][INFO ][o.e.n.Node               ] [w32xLwK] JVM arguments [-Xms512m, -Xmx512m, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -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-3167282046876579994, -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/elasticsearch-6.8.12, -Des.path.conf=/opt/elasticsearch-6.8.12/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [aggs-matrix-stats]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [analysis-common]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [ingest-common]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [ingest-geoip]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [ingest-user-agent]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [lang-expression]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [lang-mustache]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [lang-painless]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [mapper-extras]
[2021-07-25T20:05:36,435][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [parent-join]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [percolator]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [rank-eval]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [reindex]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [repository-url]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [transport-netty4]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [tribe]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-ccr]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-core]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-deprecation]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-graph]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-ilm]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-logstash]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-ml]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-monitoring]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-rollup]
[2021-07-25T20:05:36,436][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-security]
[2021-07-25T20:05:36,437][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-sql]
[2021-07-25T20:05:36,437][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-upgrade]
[2021-07-25T20:05:36,437][INFO ][o.e.p.PluginsService     ] [w32xLwK] loaded module [x-pack-watcher]
[2021-07-25T20:05:36,437][INFO ][o.e.p.PluginsService     ] [w32xLwK] no plugins loaded
[2021-07-25T20:05:40,926][INFO ][o.e.x.s.a.s.FileRolesStore] [w32xLwK] parsed [0] roles from file [/opt/elasticsearch-6.8.12/config/roles.yml]
[2021-07-25T20:05:41,869][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [w32xLwK] [controller/2980] [Main.cc@114] controller (64 bit): Version 6.8.12 (Build 39bf066b214253) Copyright (c) 2020 Elasticsearch BV
[2021-07-25T20:05:42,373][DEBUG][o.e.a.ActionModule       ] [w32xLwK] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2021-07-25T20:05:42,657][INFO ][o.e.d.DiscoveryModule    ] [w32xLwK] using discovery type [zen] and host providers [settings]
[2021-07-25T20:05:43,654][INFO ][o.e.n.Node               ] [w32xLwK] initialized
[2021-07-25T20:05:43,654][INFO ][o.e.n.Node               ] [w32xLwK] starting ...
[2021-07-25T20:05:43,842][INFO ][o.e.t.TransportService   ] [w32xLwK] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2021-07-25T20:05:43,859][WARN ][o.e.b.BootstrapChecks    ] [w32xLwK] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2021-07-25T20:05:43,859][WARN ][o.e.b.BootstrapChecks    ] [w32xLwK] max number of threads [3872] for user [es] is too low, increase to at least [4096]
[2021-07-25T20:05:43,859][WARN ][o.e.b.BootstrapChecks    ] [w32xLwK] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2021-07-25T20:05:46,923][INFO ][o.e.c.s.MasterService    ] [w32xLwK] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {w32xLwK}{w32xLwKMRSiVRg42cdZ5kQ}{qpcWMtoJSZ6MEw8FnxKbFQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1039880192, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
[2021-07-25T20:05:46,931][INFO ][o.e.c.s.ClusterApplierService] [w32xLwK] new_master {w32xLwK}{w32xLwKMRSiVRg42cdZ5kQ}{qpcWMtoJSZ6MEw8FnxKbFQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1039880192, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {w32xLwK}{w32xLwKMRSiVRg42cdZ5kQ}{qpcWMtoJSZ6MEw8FnxKbFQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=1039880192, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2021-07-25T20:05:47,011][INFO ][o.e.h.n.Netty4HttpServerTransport] [w32xLwK] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2021-07-25T20:05:47,011][INFO ][o.e.n.Node               ] [w32xLwK] started
[2021-07-25T20:05:47,015][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [w32xLwK] Failed to clear cache for realms [[]]
[2021-07-25T20:05:47,073][INFO ][o.e.g.GatewayService     ] [w32xLwK] recovered [0] indices into cluster_state
[2021-07-25T20:05:47,299][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2021-07-25T20:05:47,383][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2021-07-25T20:05:47,422][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.watches] for index patterns [.watches*]
[2021-07-25T20:05:47,505][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2021-07-25T20:05:47,576][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2021-07-25T20:05:47,608][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2021-07-25T20:05:47,654][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2021-07-25T20:05:47,725][INFO ][o.e.c.m.MetaDataIndexTemplateService] [w32xLwK] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2021-07-25T20:05:47,905][INFO ][o.e.l.LicenseService     ] [w32xLwK] license [437e59f0-fad8-4456-b193-ad5213580e7a] mode [basic] - valid

6. 检查启动是否成功及查看es节点

[root@localhost ~]# curl localhost:9200
{
  "name" : "w32xLwK",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Qz7zminvTla5pHQQu2DyZQ",
  "version" : {
    "number" : "6.8.12",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7a15d2a",
    "build_date" : "2020-08-12T07:27:20.804867Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.3",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
[root@localhost ~]# curl localhost:9200/_cat/nodes?v
ip        heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1           20          92   0    0.00    0.06     0.06 mdi       *      w32xLwK

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值