创建repo
vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
刷新
yum clean all
yum makecache
常用命令
systemctl start elasticsearch //启动
systemctl status elasticsearch //查询状态
systemctl enable elasticsearch.service //开机自启
systemctl stop elasticsearch //停止
检查是否运行起来:
image.png启动报错:
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
解决办法:
image.png
以下有些常见问题:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
// 修改下面的文件 里面是一些内核参数
vi /etc/sysctl.conf
//添加以下配置
vm.max_map_count=655360
添加完后保存,然后执行
sysctl -p
//-p 从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载
解决 max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
原因:最大文件打开数量太小,出现此错误,切换到root用户下,修改limits.conf
// 编辑此文件
vim etc/security/limits.conf
在文件后加上
- soft nofile 65536
- hard nofile 65536
SpringBoot 集成es时注意版本:
image.png
<meta charset="utf-8">
注意SpringBoot要和Elasticsearch版本对应不然:
[NoNodeAvailableException[None of the configured nodes are available]
当然也有可能是
image.png
名称没对应上!
关注公众号回复“书籍”就可以看大佬看得同款书籍了:
image.png
网友评论