- 自行安装nodejs
- 安装phantomjs
cd /usr/local/
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs- 2.1.1-linux-x86_64.tar.bz2
安装解压工具并解压
yum install -y bzip2
tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2
修改环境变量
vim /etc/profile
#添加
export PATH=$PATH:/usr/local/phantomjs-2.1.1-linux-x86_64/bin
配置生效
source /etc/profile
- 安装elasticsearch-head
安装组件
npm install -g grunt-cli
npm install grunt
npm install grunt-contrib-clean
npm install grunt-contrib-concat
npm install grunt-contrib-watch
npm install grunt-contrib-connect
安装git
yum -y install git
安装elasticsearch-head
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install -g cnpm --registry=https://registry.npm.taobao.org
- elasticsearch-head发现主机,需要在es的配置文件 elasticsearch.yml修改跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
- 启动
在elasticsearch-head中执行
#启动时这里如果提示有些组件找不到,找不到的组件重新安装一次
npm run start
浏览器输入http://192.168.247.130:9100/
然后再页面中连接集群地址http://192.168.247.130:9200/
在kibana下创建索引
这个索引有2个分片和2个副本
PUT /cluster-index
{
"settings": {
"number_of_shards": "2",
"number_of_replicas": "2"
},
"mappings": {
"properties": {
"name": {
"type": "text"
}
}
}
}
查看Elasticsearch head
这里的索引库有两个分片
分片0的主节点在node3上,分片1的主节点在node2上