duydo/elasticsearch-analysis-vietnamese

Hướng dẫn đầy đủ cài đặt đây !

thusinh1969 opened this issue · 12 comments

*** Môi trường Ubuntu 18.04 (or whatever), phải install Java JDK chứ không phải JRE vì cần javac cho cái C++ Tokenizer. Các file .yml tự làm cho chuẩn theo hường dẫn của các gits. Docker hay VM cũng vậy, đơn giản thế này.

sudo su
apt-get update -y
apt-get upgrade -y
apt-get install build-essential cmake unzip pkg-config gcc-7 g++-7 -y
apt-get install wget curl nano git default-jdk maven -y

cd /

*** Tải ElasticSearch 7.12.1
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-linux-x86_64.tar.gz
tar -xzf elasticsearch-7.12.1-linux-x86_64.tar.gz
mv elasticsearch-7.12.1-linux-x86_64 /es

** Tải ES Analysis Vietnam
git clone https://github.com/duydo/elasticsearch-analysis-vietnamese.git
cd elasticsearch-analysis-vietnamese
mvn package

** Tải C++ Tokenizer
git clone https://github.com/coccoc/coccoc-tokenizer.git
cd coccoc-tokenizer
mkdir build
cd build
cmake -DBUILD_JAVA=1 ..
make install

** Cài plugin:
cd /es
echo "Y" | ./bin/elasticsearch-plugin install file:///elasticsearch-analysis-vietnamese/target/releases/elasticsearch-analysis-vietnamese-7.12.1.zip

*** Chuẩn bị
groupadd -g 999 nqrt && useradd -r -u 999 -g nqrt nqrt
usermod -aG sudo nqrt
chown nqrt:nqrt /es -R
sysctl -w vm.max_map_count=262144

su nqrt

** Run
export ES_JAVA_OPTS="-Xms2048m -Xmx2048m -Djava.library.path=/usr/local/lib"
cd /es
./bin/elasticsearch

Lưu ý: nên dùng ES 7.3.1, các version cũ crash loạn xạ với Java core dump !

sudo su
apt-get update -y
apt-get upgrade -y
apt-get install build-essential cmake unzip pkg-config gcc-7 g++-7 -y
apt-get install wget curl nano git -y

cd /

*** Tải ElasticSearch 7.3.1
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.1-linux-x86_64.tar.gz
tar -xzf elasticsearch-7.3.1-linux-x86_64.tar.gz
mv elasticsearch-7.3.1-linux-x86_64 /es

export PATH=$PATH:/es/jdk/bin
export JAVA_HOME=/es/jdk
export ES_JAVA_HOME=/es/jdk

** Tải ES Analysis Vietnam
wget https://github.com/duydo/elasticsearch-analysis-vietnamese/releases/download/v7.3.1/elasticsearch-analysis-vietnamese-7.3.1.zip
mv elasticsearch-analysis-vietnamese-7.3.1.zip /tmp

** Tải C++ Tokenizer
git clone https://github.com/coccoc/coccoc-tokenizer.git
cd coccoc-tokenizer
mkdir build
cd build
cmake -DBUILD_JAVA=1 ..
make install

** Cài plugin:
cd /es
echo "Y" | ./bin/elasticsearch-plugin install file:///tmp/elasticsearch-analysis-vietnamese-7.3.1.zip

*** Chuẩn bị
groupadd -g 999 nqrt && useradd -r -u 999 -g nqrt nqrt
usermod -aG sudo nqrt
chown nqrt:nqrt /es -R
sysctl -w vm.max_map_count=262144

su nqrt

** Run
export ES_JAVA_OPTS="-Xms2048m -Xmx2048m -Djava.library.path=/usr/local/lib"
cd /es
./bin/elasticsearch

Steve

duydo commented

Lưu ý: nên dùng ES 7.3.1, các version cũ crash loạn xạ với Java core dump !

v7.3.1 xài tokenizer cũ của anh Phương chứ không xài coccoc-tokenizer nha, trong README có nói rõ

Cám ơn bác đã bỏ thời gian ra viết hướng dẫn cài đặt chi tiết cho mọi người.

Dành cho bạn nào cần sử dụng docker
https://github.com/viiiprock/es-vietnamese-docker

Mình có viết Dockerfile/Docker-Compose Elasticsearch 7.12.1 với coccoc-tokenizer và elasticsearch-analysis-vietnamese cho ae nào cần https://github.com/cpfriend1721994/docker-es-cococ-tokenizer

@cpfriend1721994 Lúc mình chạy từ Dockerfile thì gặp lỗi này:
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log
{"type": "server", "timestamp": "2022-01-14T06:17:11,550Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "stopping ..." }
{"type": "server", "timestamp": "2022-01-14T06:17:11,555Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "stopped" }
{"type": "server", "timestamp": "2022-01-14T06:17:11,555Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "closing ..." }
{"type": "server", "timestamp": "2022-01-14T06:17:11,560Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "closed" }
{"type": "server", "timestamp": "2022-01-14T06:17:11,562Z", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "Native controller process has stopped - no new native processes can be started" }

Xin giúp đỡ!

@cpfriend1721994 Lúc mình chạy từ Dockerfile thì gặp lỗi này: ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch. bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured ERROR: Elasticsearch did not exit normally - check the logs at /usr/share/elasticsearch/logs/docker-cluster.log {"type": "server", "timestamp": "2022-01-14T06:17:11,550Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "stopping ..." } {"type": "server", "timestamp": "2022-01-14T06:17:11,555Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "stopped" } {"type": "server", "timestamp": "2022-01-14T06:17:11,555Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "closing ..." } {"type": "server", "timestamp": "2022-01-14T06:17:11,560Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "closed" } {"type": "server", "timestamp": "2022-01-14T06:17:11,562Z", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "localhost", "message": "Native controller process has stopped - no new native processes can be started" }

Xin giúp đỡ!

chua install cococ tokenizer cpp nha ban => https://github.com/miczone/coccoc-tokenizer.git

@hoptrangetcare bạn tạo issues trên repo chính giúp mình nhé, bạn chạy từ docker-compose thì bị lỗi không

image

Mình chạy mvn package thì bắn ra log này , mn có ai bị lỗi này chưa nhỉ ? version mình dùng là 7.14.2

2023-02-22_15-11-43

mình install tokenizer của coccoc thì gặp lỗi này, có ai biết cách fix không ạ

Em đang thử trên elastic phiên bản 8.7 nhưng chưa build được file .zip để thêm vào, toàn báo lỗi, không biết đã ai làm chưa
Screenshot from 2023-04-17 16-45-28
Screenshot from 2023-04-18 08-21-19
Screenshot from 2023-04-18 08-43-53

duydo commented

Mình mới update plugin cho v8.7.0, có hỗ trợ build Docker image rồi nhé.