本文共 3153 字,大约阅读时间需要 10 分钟。
tar -xzf elasticsearch-7.5.1-linux-x86_64.tar.gz
# 以root用户来创建新的用户 , groupadd 添加一个用户组[root@localhost home]# groupadd elasticsearch # 添加一个用户,-g是在用户组下 -p是密码[root@localhost home]# useradd elasticsearch -g elasticsearch -p elasticsearch
# 给用户elasticsearch 授权[root@localhost home]# chown -R elasticsearch:elasticsearch elasticsearch-7.5.1/
vim /etc/security/limits.conf#添加以下配置elastic hard nofile 65536elastic soft nofile 65536* soft nproc 65536* hard nproc 65536
vim /etc/sysctl.conf#添加vm.max_map_count=655360#因为默认vm.max_map_count=65530#添加完成后必须执行以下命令配置才可生效sysctl -p
# ------------------------------------ Node ------------------------------------# Use a descriptive name for the node:node.name: node-1# ----------------------------------- Paths ------------------------------------# Path to directory where to store the data (separate multiple locations by comma):path.data: /data/appdatas/elasticsearch/to/data# Path to log files:path.logs: /data/appdatas/elasticsearch/to/logs# ---------------------------------- Network -----------------------------------# Set the bind address to a specific IP (IPv4 or IPv6):network.host: 0.0.0.0# Set a custom port for HTTP:http.port: 9200# --------------------------------- Discovery ----------------------------------# Bootstrap the cluster using an initial set of master-eligible nodes:cluster.initial_master_nodes: ["node-1"]
# 切换到 elasticsearch 用户su elasticsearch#进到es的bin目录下cd elasticsearch-7.5.1/bin#启动。./elsticsearch#要想放到后台进程启动,就用./elsticsearch -d#判断后台启动是否成功,可执行如下命令,查看是否存在9200端口ss -tanl
{ "name" : "ip101", "cluster_name" : "elasticsearch", "cluster_uuid" : "_na_", "version" : { "number" : "7.4.1", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "fc0eeb6e2c25915d63d871d344e3d0b45ea0ea1e", "build_date" : "2019-10-22T17:16:35.176724Z", "build_snapshot" : false, "lucene_version" : "8.2.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search"}
结果同上
(1)org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node(es版本为5.6.16)
解决办法: 修改elasticsearch config目录下的elasticsearch.yml,添加node.max_local_storage_nodes: 256#action.destructive_requires_name: truenode.max_local_storage_nodes: 256
(2)ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured(es版本为7.5.1) 解决办法: 修改elasticsearch.yml修改前:#cluster.initial_master_nodes: ["node-1"]修改后(将注释取消即可):cluster.initial_master_nodes: ["node-1"]
转载地址:http://nmtii.baihongyu.com/