ElasticSearch 7.2 学习一(搭建及配置)

yum安装

在/etc/yum.repos.d/下新建文件elasticsearch.repo,内容:

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

执行安装命令:

yum install elasticsearch

设置开机启动:

chkconfig --add elasticsearch

启动和停止:

service elasticsearch start
service elasticsearch stop

测试:

curl -X GET "localhost:9200/"

文件路径

Type Description Default Location Setting
home Elasticsearch home directory or $ES_HOME /usr/share/elasticsearch
bin Binary scripts including elasticsearch to start a node and elasticsearch-plugin to install plugins /usr/share/elasticsearch/bin
conf Configuration files including elasticsearch.yml /etc/elasticsearch
conf Environment variables including heap size, file descriptors. /etc/sysconfig/elasticsearch
data The location of the data files of each index / shard allocated on the node. Can hold multiple locations. /var/lib/elasticsearch path.data
logs Log files location. /var/log/elasticsearch path.logs
plugins Plugin files location. Each plugin will be contained in a subdirectory. /usr/share/elasticsearch/plugins
repo Shared file system repository locations. Can hold multiple locations. A file system repository can be placed in to any subdirectory of any directory specified here. Not configured path.repo

配置

vi /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]

变更数据存放路径

修改配置文件

vi /etc/elasticsearch/elasticsearch.yml

修改字段值:
path.data: /home/elasticsearch/data
迁移文件:

cp -r /var/lib/elasticsearch/nodes/* /home/elasticsearch/data/nodes/

设置权限:

cd /home/elasticsearch/
chown -R elasticsearch:elasticsearch *
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容