Elasticsearch-7.8インストール
9571 ワード
Elasticsearch-7.8インストール
ダウンロード
elasticの公式サイトからelastic.co/downloads/elasticsearch最新バージョンのElasticsearchを取得します.
配置
adduser elasticsearch
passwd elasticsearch
chown -R elasticsearch elasticsearch-7.8.0 es
./elasticsearch -d
http://localhost:9200
質問1:max file descriptors[4096]for elasticsearch process is toolow,increase to at least[65535]各プロセスは同時にファイル数が小さすぎるulimit-Hn ulimit-Snコマンドを開いて修正/etc/security/limitsを表示する.confファイル、構成を追加し、ユーザーが終了した後に再ログインして有効にする
soft nofile 65536
hard nofile 65536
質問2:max virtual memory areas vm.max_map_count[65530]is too low,increase to at least[262144]修正/etc/sysctl.confファイル、構成vmを追加する.max_map_count=262144
vi /etc/sysctl.conf
sysctl -p
elasticsearch-headのインストール
1、nodeをインストールする.jsダウンロードアドレス:https://nodejs.org/en/download/tar -xJf node-v10.16.3-linux-x64.tar.xz
vi /etc/profile
export NODE_HOME=/usr/local/node-v10.16.3-linux-x64
export PATH=$NODE_HOME/bin:$PATH
source /etc/profile
2、elasticsearchを構成し、headプラグインのリモートアクセスを許可する
cd /opt/es/elasticsearch-7.8.0/config
vi elasticearch.yml
プロファイルの最後に次の内容を追加し、elasticsearchサービスを再起動します.
http.cors.enabled: true
http.cors.allow-origin: "*"
gruntのインストール
npm install -g grunt
3、elastic-search-masterを起動する
npm install
npm run start
nohup npm run start & #
curl -X GET http://localhost:9100/
中国語の分詞プラグイン
ダウンロード先:https://github.com/medcl/elasticsearch-analysis-ikpluginsの下にフォルダを作成する
mkdir ik
plugins/ikに解凍してesを再起動
curl -X GET -H "Content-Type: application/json" "http://localhost:9200/_analyze?pretty=true" -d'{"text":" "}';
効果:
{
"tokens" : [
{
"token" : " ",
"start_offset" : 0,
"end_offset" : 1,
"type" : "" ,
"position" : 0
},
{
"token" : " ",
"start_offset" : 1,
"end_offset" : 2,
"type" : "" ,
"position" : 1
},
{
"token" : " ",
"start_offset" : 2,
"end_offset" : 3,
"type" : "" ,
"position" : 2
},
{
"token" : " ",
"start_offset" : 3,
"end_offset" : 4,
"type" : "" ,
"position" : 3
},
{
"token" : " ",
"start_offset" : 4,
"end_offset" : 5,
"type" : "" ,
"position" : 4
},
{
"token" : " ",
"start_offset" : 5,
"end_offset" : 6,
"type" : "" ,
"position" : 5
},
{
"token" : " ",
"start_offset" : 6,
"end_offset" : 7,
"type" : "" ,
"position" : 6
}
]
}