#下載
wget http://yellowcong.qiniudn.com/elasticsearch-6.0.0.tar.gznode
#解壓
tar -zxvf elasticsearch-6.0.0.tar.gzgit
#添加用戶
adduser jing github
#設定密碼
passwd jingnpm
#添加權限
chown -R yellowcong elasticsearch-6.0.0bootstrap
#切換用戶
su jing vim
#查看當前用戶
who am ibash
#啓動elasticsearch服務器
#修改sysctl配置
vim /etc/sysctl.confapp
#添加以下配置
vm.max_map_count=655360cors
#讓配置生效
sysctl -p
#查看配置的數目
sysctl -a|grep vm.max_map_count
#配置limits.conf
vim /etc/security/limits.conf
#jing 是用戶名
jing hard nofile 65536
jing soft nofile 65536
#從新登陸 jing 帳戶,查看是否生效
su jing
#查看配置是否生效
ulimit -Hn
#修改elasticsearch.yml文件
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
head插件安裝
先安裝,nvm,便是Node Version Manager(Node版本管理器)
#使用 wget安裝
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
#激活nvm
source ~/.nvm/nvm.sh
#激活完成後,安裝node
nvm install node
#安裝完成後,切換到該版本
nvm use node
#node驗證
node -v
npm -v
#修改elasticsearch.yml文件
#增長參數,使head插件能夠訪問es
http.cors.enabled: true
http.cors.allow-origin: "*"
#下載head插件
URL:https://codeload.github.com/mobz/elasticsearch-head/zip/master
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
#解壓後 存放在 /usr/local/下 注:不要放在/elasticsearch-6.0.0/plugins下
#安裝grunt
npm install -g grunt-cli
grunt -version
#修改服務器監聽地址:Gruntfile.js
connect: {
server: {
options: {
port: 9100,
base: '.',
keepalive: true,
hostname: '*'
}
}
}
#修改鏈接地址:_site/app.js
init: function(parent) {
this._super();
this.prefs = services.Preferences.instance();
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.2.130:9200";
#在elasticsearch-head-master目錄下
npm install(安裝下載下來的包)
#能夠採用screen放在後臺運行,否則退出ssh後grunt進程就關閉了。
grunt server &
#grunt server 退出ssh後grunt進程就關閉
#啓動elastic服務
elasticsearch-6.0.0/bin/elasticsearch
#後臺啓動 elasticsearch-6.0.0/bin/elasticsearch -d