linux 安装elasticsearch和head
1.下载ES
下载安装前请注意需要对应JDK版本
本示例JDK版本:1.8
ES版本: 7.13.4
下载地址
2.解压ES
手动上传到远程服务器,
执行命令解压:
tar -zxvf elasticsearch-7.13.4-linux-x86_64.tar.gz
mv elasticsearch-7.13.4 /home/
3.安装并修改环境配置
创建文件夹,并给文件夹chmod权限
/home/data/es_data
/home/data/logs
创建ES用户,并给用户赋予ES文件访问权限
cd /home/elasticsearch-7.13.4/config
vi elasticsearch.yml
#修改ES配置文件
#集群名称
cluster.name: my-es
#节点名称
node.name: my-es-1
#数据存放路径
path.data: /home/data/es_data
#日志
path.logs: /home/data/logs
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
cluster.initial_master_nodes: ["my-es-1"]
#绑定地址
network.host: 0.0.0.0
#端口
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
vi /etc/sysctl.conf
在文件末尾追加:vm.max_map_count=655360
保存后执行 sysctl -p
vi /etc/security/limits.conf
## 65535修改为65536
* soft nofile 65536
* hard nofile 65536
## 文件末尾追加
* soft nproc 4096
* hard nproc 4096
以上配置完成后退出,重新登录即可
4.启动elasticsearch
注:启动elasticsearch不能用root账户
/home/elasticsearch-7.13.4/bin/elasticsearch
访问 http://192.168.253.131:9200/
{
"name" : "my-es-1",
"cluster_name" : "my-es",
"cluster_uuid" : "3mV0a_P-SBCvoCNckfzHog",
"version" : {
"number" : "7.13.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "c5f60e894ca0c61cdbae4f5a686d9f08bcefc942",
"build_date" : "2021-07-14T18:33:36.673943207Z",
"build_snapshot" : false,
"lucene_version" : "8.8.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
5.下载es-head
安装head前需要安装nodejs
下载地址
转换: xz -d node-v16.13.0-linux-x64.tar.xz
解压:tar xvf node-v16.13.0-linux-x64.tar.xz
转换: xz -d node-v16.13.0-linux-x64.tar.xz
解压:tar xvf node-v16.13.0-linux-x64.tar.xz
mv node-v16.13.0-linux-x64 /usr/local/
vi /etc/profile
export NODE_HOME=/usr/local/node-v16.13.0-linux-x64
export NODE_PATH=${NODE_HOME}/lib
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
[root@localhost node-v16.13.0-linux-x64]# node -v
v16.13.0
#安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
6.安装grunt
下载地址:https://codeload.github.com/mobz/elasticsearch-head/zip/master
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
unzip master.zip
cd elasticsearch-head-master
cnpm install
vim Gruntfile.js
执行
cnpm run start
访问下面地址:以上就部署成功了