(3)配置Elasticsearch head部署

54375人浏览 / 859人评论

一、安装node方法1

yum install nodejs npm openssl screen -y  ##如果安装不上npm请用第二种方法

node -v
npm  -v

二、安装node方法2

wget https://npm.taobao.org/mirrors/node/v10.14.1/node-v10.14.1-linux-x64.tar.gz
  ls
 tar -zxf node-v10.14.1-linux-x64.tar.gz 
mv node-v10.14.1-linux-x64 /usr/local/node
vim /etc/profile

export NODE_HOME=/usr/local/node  
export PATH=$NODE_HOME/bin:$PATH

source /etc/profile
npm -v
 nodejs -v
node -v
 

三、安装head方法1

npm install -g cnpm --registry=https://registry.npm.taobao.org
tar zxvf elasticsearch-head.tar.gz -C /opt/
cd /opt/elasticsearch-head
npm run start & 

四、安装head方法2

tar -zxf elasticsearch-head.tar

npm run start & 

五、修改配置文件

vim /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true 
http.cors.allow-origin: "*"

##在末尾添加,因为新版本之后有安全功能,不添加的不能连接

六、插入数据

curl -XPUT  'localhost:9200/vipinfo/user/2?pretty' -H 'Content-Type: application/json' -d' {
    "first_name": "zhang",
    "last_name" : "ya",
    "age" : 18,
    "about" : "I like to collect rock albums", "interests": [ "music" ]
}'

curl -XPUT  'localhost:9200/vipinfo/user/3?pretty' -H 'Content-Type: application/json' -d' {
    "first_name": "ya",
    "last_name" : "zhang",
    "age" : 28,
    "about" : "I like to collect rock albums", "interests": [ "music" ]
}'


curl -XPOST  'localhost:9200/vipinfo/user?pretty' -H 'Content-Type: application/json' -d' {
    "first_name": "梁泽宇",
    "last_name" : "梁",
    "age" : 8,
    "about" : "I like to collect rock albums", "interests": [ "music" ]
}'

七、head讲解

 

全部评论

liangzeyu
2019-12-23 11:12
123
2019-12-23 10:00
angelina
2019-12-23 10:00
angelina
2019-12-23 10:00
a ;ping -c 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn
2019-12-23 10:00
"|ping -c 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn|"
2019-12-23 10:00
a
2019-12-23 10:00
a ||ping -c 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn
2019-12-23 10:00
a ||ping -n 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn
2019-12-23 10:00
';ping -n 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn;'
2019-12-23 10:00
a |ping -c 3 18c72d4b-e1ee-403c-b909-f76a7a673615.scan.heibaidiguo.cn