博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Elasticsearch非集群单节点安装教程
阅读量:4095 次
发布时间:2019-05-25

本文共 3153 字,大约阅读时间需要 10 分钟。

安装

  1. 下载elasticsearch安装包
    https://www.elastic.co/cn/products/elasticsearch
  2. 解压
tar -xzf elasticsearch-7.5.1-linux-x86_64.tar.gz
  1. elasticsearch不能以root用户启动,需创建一个新的用户
# 以root用户来创建新的用户 , groupadd 添加一个用户组[root@localhost home]# groupadd elasticsearch # 添加一个用户,-g是在用户组下 -p是密码[root@localhost home]# useradd elasticsearch -g elasticsearch -p elasticsearch
  1. 授权新用户elasticsearch为elasticsearch-7.5.1/文件夹的所有者
# 给用户elasticsearch 授权[root@localhost home]# chown -R elasticsearch:elasticsearch elasticsearch-7.5.1/
  1. 用root用户,编辑limits.conf配置文件,修改用户最大可创建文件数,因为可创建文件数太小的话elasticsearch启动不了
vim /etc/security/limits.conf#添加以下配置elastic   hard    nofile  65536elastic   soft    nofile  65536* soft    nproc   65536* hard    nproc   65536
  1. 用root用户,修改配置文件sysctl.conf文件,调大最大虚拟内存,因为虚拟内存太小的话es也启动不了
vim /etc/sysctl.conf#添加vm.max_map_count=655360#因为默认vm.max_map_count=65530#添加完成后必须执行以下命令配置才可生效sysctl -p
  1. 进入es文件夹,修改config/elasticsearch.yml配置文件,将network.host的值设置为0.0.0.0表示对所有的ip授权
# ------------------------------------ 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"]
  1. 切换到elasticsearch用户下就可以启动了( es7要使用jdk11)
# 切换到 elasticsearch 用户su elasticsearch#进到es的bin目录下cd elasticsearch-7.5.1/bin#启动。./elsticsearch#要想放到后台进程启动,就用./elsticsearch -d#判断后台启动是否成功,可执行如下命令,查看是否存在9200端口ss -tanl

测试es

  1. 访问 http://192.168.8.101:9200
{  "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. curl http://192.168.8.101:9200
结果同上

遇到的问题

(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/

你可能感兴趣的文章
剑指_复杂链表的复制
查看>>
FTP 常见问题
查看>>
shell 快捷键
查看>>
MODULE_DEVICE_TABLE的理解
查看>>
No devices detected. Fatal server error: no screens found
查看>>
db db2_monitorTool IBM Rational Performace Tester
查看>>
postgresql监控工具pgstatspack的安装及使用
查看>>
swift中单例的创建及销毁
查看>>
【JAVA数据结构】双向链表
查看>>
【JAVA数据结构】先进先出队列
查看>>
谈谈加密和混淆吧[转]
查看>>
乘法逆元
查看>>
Objective-C 基础入门(一)
查看>>
找工作准备的方向(4月22日写的)
查看>>
关于fwrite写入文件后打开查看是乱码的问题
查看>>
用结构体指针前必须要用malloc,不然会出现段错误
查看>>
Linux系统中的美
查看>>
一些实战项目(linux应用层编程,多线程编程,网络编程)
查看>>
STM32CubeMX 真的不要太好用
查看>>
不要买铝合金机架的无人机,不耐摔,易变形弯曲。
查看>>