ES搜索引擎环境搭建之单机

 

1.下载ElasticSearch6.2.4

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz

2.解压文件

tar -zxvf elasticsearch-6.2.4.tar.gz

3.重新命名(注:这里是将解压后的elasticsearch文件夹移动到指定目录下并修改名称,不移动不改名这个步骤可以忽略,但是之后的步骤中文件路径要修改成你elasticsearch存放的路径)

mv elasticsearch-6.2.4 /usr/local/elastic/elasticsearch

4.创建数据存放路径

mkdir /usr/local/elastic/elasticsearch/data

5.创建日志存放路径(如已存在不用创建)

mkdir /usr/local/elastic/elasticsearch/logs

6.创建用户并授权(因为es不能root用户运行)

useradd es

chown -R es:es /usr/local/elastic/elasticsearch

7.修改 config 目录下的 elasticsearch.yml 文件

vim elasticsearch.yml

// 去掉行开头的 # 并重命名集群名,这里命名为my-es 

cluster.name: my-es 

// 去掉行开头的 # 并重命名节点名,这里命名为 node-1

node.name: node-1

// 将ip限制设置为无限制

# network.host: 0.0.0.0

//端口号

# http.port: 9200

8. 进入 bin 目录启动 ES 并在后台运行

//切换用户身份

su es 

./elasticsearch -d

9.启动之后测试是否正常运行(只能在bin目录下运行才有效)

curl 127.0.0.1:9200

返回结果:

注:搭建ES环境的前提是linux已装有JDK1.8以上  没有请先安装  ps -ef | grep elastic 查看es进程号

 

 

以上操作成功后只能在内容访问ES  外网访问不了 如果你打算转ElasticSearch-head/kibana可视化的话  进行以下操作

1.修改 config 目录下的 elasticsearch.yml 文件

// 去掉行开头的 #

network.host: 0.0.0.0

// 去掉行开头的 #

http.port: 9200

2.根据提示错误修改信息

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 [3818] for user [elasticsearch] 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]

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

每个进程最大同时打开文件数太小

修改 /etc/security/limits.conf 文件,增加如下配置,用户退出后重新登录生效

* soft nofile 65536

* hard nofile 65536

[2]: max number of threads [3818] for user [es] is too low, increase to at least [4096]

最大线程个数太低

同上修改 /etc/security/limits.conf 文件,增加如下配置,用户退出后重新登录生效

* soft nproc 4096

* hard nproc 4096

[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

一个进程能拥有的最多的内存区域

修改 /etc/sysctl.conf 文件,增加如下配置,执行命令「 sysctl -p 」生效

vm.max_map_count=262144

3.在浏览器打开 http://ip:9200

返回结果

恭喜你成功了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

PHP小渣渣

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值