安装
单机安装
docker容器安装Elasticsearch7
1.创建目录 并授权
mkdir -p /usr/local/elasticsearch/config
mkdir -p /usr/local/elasticsearch/data
mkdir -p /usr/local/elasticsearch/plugins
echo "http.host: 0.0.0.0" >> /usr/local/elasticsearch/config/elasticsearch.yml
chmod 777 -R /usr/local/elasticsearch
2.启动运行
docker run -d --name elasticsearch7 -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms128m -Xmx128m" \
-v /usr/local/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /usr/local/elasticsearch/data:/usr/share/elasticsearch/data \
-v /usr/local/elasticsearch/plugins:/usr/share/elasticsearch/plugins elasticsearch:7.10.1
参数说明
-e "discovery.type=single-node" 设置为单节点
-e ES_JAVA_OPTS="-Xms128m -Xmx128m" 设置ES的初始内存和最大内存,否则过大启动不了ES
3.发现外网访问不到,只能 127.0.0.1:9200 访问,设置网络
vi /etc/sysctl.conf
发现 net.ipv4.ip_forward=0,应改为 net.ipv4.ip_forward=1,并执行使之生效
systemctl restart network
源码安装Elasticsearch7
TODO
集群安装
TODO