Linux安装配置ElasticSearch
📌 下载ElasticSearch
🌈 本人下载的是7.6.1版本的,如果你也是想要这个版本可以直接点此 最新版本可以去下载
📌 安装ES
🌈 下载完成后移动进linux服务器中,本人放在了/usr/local/elastic下,并解压
tar zxvf elasticsearch-7.6.1-linux-x86_64.tar.gz
🌈 因为ES不能使用root用户启动,所以需要新建用户
useradd user-es #创建用户 chown user-es:user-es -R /usr/local/elasticsearch-7.6.1 #授予权限 su user-es #切换用户🌈 进入bin目录下,后台启动ES
./elasticsearch -d
🌈 如果遇到错误信息: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
-
解决方法:
# 修改ElasticSearch配置 vim config/elasticsearch.yml # 追加内容 "node-1"是节点名称(默认主机名) cluster.initial_master_nodes: ["node-1"]
🌈 若遇到max number of threads [3882] for user [xxx] is too low, increase to at least [4096]
-
解决方法:
切换root用户 vi /etc/sysctl.conf vm.max_map_count=655360 保存后执行 sysctl -p
🌈 修改elasticsearch.yml文件,使外网可以访问,别忘了要打开9200端口哈 🌈 OK,之后我们进去bin文件夹,启动es
📌 下载Kibana
🌈 因为笔者ES安装是7.6.1版本,所以Kibana也是此版本,可点击直接
🌈 解压
tar -zxvf kibana-7.6.1-linux-x86_64.tar.gz
🌈 进入bin文件夹,修改配置文件
server.port: 5601 #端口 server.host: "0.0.0.0" #所有主机都能访问,或者也可以指定一个ip elasticsearch.hosts: ["http://localhost:9200"] #配置es的访问地址 kibana.index: ".kibana"
🌈 给ES用户授权
chown -R user-es:user-es /usr/local/elastic/kibana-7.6.1-linux-x86_64
🌈 切换用户,启动kibana,不要忘记开放5601端口哈
su user-es nohup ./kibana &
🌈 测试
📌 下载elasticsearch-head
🌈 下载插件并解压
wget https://codeload.github.com/mobz/elasticsearch-head/zip/refs/heads/master unzip elasticsearch-head-master.zip
🌈 进入elasticsearch-head-master,安装node_module
npm install -g cnpm -registry=https://registry.npm.taobao.org
🌈 后台启动head,记得开启9100端口
grunt server &
