安装Elasticsearch
官网:https://www.elastic.co/cn/
把下载的压缩包传递到liux
解压:tar -zxvf 压缩包名称
vim /etc/sysctl.conf,最后一行添加:
vm.max_map_count=2621441
接着执行 /sbin/sysctl -p 使文件生效
vim /etc/security/limits.conf 添加:
* soft nofile 65535
* hard nofile 65535
此文件修改后需要重新登录用户,才会生效
修改es配置
vim /home/axs-es/elasticsearch/elasticsearch-7.6.0/config/elasticsearch.yml
在最后一行添加:
cluster.initial_master_nodes: ["node-1"]
node.name: node-1
#设置为0.0.0.0表示所有用户都可以访问。
network.host: 0.0.0.0
#启动端口
http.port: 9200
#跨域请求
http.cors.enabled: true
http.cors.allow-origin: "*"
#支持跨域请求类型
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
#http.cors.allow-methods: "GET"
#支持跨域请求头类型
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, X-User"
启动es:
进入文件夹所在的bin目录:./elasticsearch
安装elasticsearch-head
安装nodejs
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
或者
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
然后
yum -y install nodejs
最后查看版本
node -v
安装git
yum install -y git
查看git版本
git --version
安装elasticsearch-head
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start