docker安装(推荐)
bashdocker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 --restart=always -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms128m -Xmx512m" docker.elastic.co/elasticsearch/elasticsearch:7.10.1
重置密码
bashbin/elasticsearch-reset-password -u elastic
bashbin/elasticsearch-setup-passwords interactive
手动安装
环境准备
- 安装java环境
bashyum install -y java-1.8.0-openjdk
- 配置环境变量
update-alternatives --config java
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.aarch64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
javac
下载地址
elasticsearch安装
不能安装在root目录,会权限不足启动失败
yum -y install wget
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.10.0-linux-x86_64.tar.gz -C /usr/local/
adduser es
passwd es
chown -R es elasticsearch-7.10.0
su es
vi config/elasticsearch.yml
network.host: 0.0.0.0
discovery.type: single-node
jvm.options改内存
./bin/elasticsearch -d
curl http://localhost:9200/
中文分词器
https://github.com/medcl/elasticsearch-analysis-ik
用root账户安装
bash./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.0/elasticsearch-analysis-ik-7.10.0.zip
smartcn分词器
bashbin/elasticsearch-plugin install analysis-smartcn
canal安装
bashdocker run -p 11111:11111 --name canal -m 512M --memory-swap -1 canal/canal-server docker update --restart=always canal
F&Q
- 内存不足
/usr/local/logstash-7.10.0/config/jvm.options 添加以下代码
-Xms512m
-Xmx512m
- 启动权限问题
不能使用root用户,新建一个用户
NODE API
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/get_examples.html https://blog.csdn.net/UbuntuTouch/article/details/122874932