CentOS7安装Elasticsearch7下载地址:https://www.elastic.co/cn/dow...使用YUM安装# 下载并安装公共签名密钥rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch# 配置RPM仓库vim /etc/yum.repos.d/elasticsearch.repo[elasticsearch-7.x]name=Elasticsearch repository for 7.x packagesbaseurl=https://artifacts.elastic.co/packages/7.x/yum# Apache 2.0 license#baseurl=https://artifacts.elastic.co/packages/oss-7.x/yumgpgcheck=1gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearchenabled=1autorefresh=1type=rpm-mdyum install -y elasticsearch配置服务启动服务之前一定要先配置/etc/elasticsearch/elasticsearch.yml的network.host、http.port和cluster.initial_master_nodes。
firewall-cmd --zone=public --add-port=9200/tcp --permanentfirewall-cmd --reloadsudo /bin/systemctl daemon-reloadsudo /bin/systemctl enable elasticsearch.service# 启动停止服务sudo systemctl start elasticsearchsudo systemctl stop elasticsearch测试服务[root@localhost ~]# curl "http://127.0.0.1:9200/"{ "name" : "localhost.localdomain", "cluster_name" : "elasticsearch", "cluster_uuid" : "Pxdp0Z24SJ-MIBH_2oMe2A", "version" : { "number" : "7.1.1", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "7a013de", "build_date" : "2019-05-23T14:04:00.380842Z", "build_snapshot" : false, "lucene_version" : "8.0.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search"}常用文件# 配置文件vim /etc/elasticsearch/elasticsearch.yml# JVM配置vim /etc/elasticsearch/jvm.options# 启动日志tail -n 10 -f /var/log/elasticsearch/elasticsearch.log问题处理绑定IP和跨域vim /etc/elasshellticsearch/elasticsearch.yml# 允许任意IP访问network.host: 0.0.0.0# 修改开放的端口http.port: 9200# 最后添加跨域http.cors.enabled: truehttp.cors.allow-origin: "*"启动失败启动报错信息如下: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 configuredvim /etc/elasticsearch/elasticsearch.yml# 修改【#cluster.initial_master_nodes: ["node-1", "node-2"] 】cluster.initial_master_nodes: ["node-1"]进程虚拟内存不足vim /etc/sysctl.conf# 添加vm.max_map_count=262144# 保存后执行sysctl -pRPM目录类型描述默认位置设置homeElasticsearch主目录或 $ES_HOME/usr/share/elasticsearch bin二进制脚本,包括elasticsearch启动节点和elasticsearch-plugin安装插件/usr/share/elasticsearch/bin conf配置文件elasticsearch.yml/etc/elasticsearchES_PATH_CONFconf环境变量,包括堆大小,文件描述符/etc/sysconfig/elasticsearc data节点上分配的每个索引、分片的数据文件的位置。可以容纳多个位置。/var/lib/elasticsearchpath.datalogs日志文件位置/var/log/elasticsearchpath.logsplugins插件文件位置。每个插件都将包含在一个子目录中。/usr/share/elasticsearch/plugins repo共享文件系统存储库位置。可以容纳多个位置。文件系统存储库可以放在此处指定的任何目录的任何子目录中。Not configuredpath.repo配置ElasticsearchElasticsearch默认使用/etc/elasticsearch运行时配置。此目录的所有权以及此目录中的所有文件在安装时都设置为root:elasticsearch,并且目录设置了setgid标志,以便在/etc/elasticsearch下创建的所有文件和子目录,例如使用密钥库创建密钥库工具等。
...