CentOS6.5安装Elasticsearch6.7.0问题及解决方案

CentOs6.5集群搭建请参考

安装启动Elasticsearch

下载Elasticsearch6.7.0,可以使用官网方式下载,也可以在百度搜索百度网盘下载,下载之后使用WinSCP将文件传到虚拟机中

CentOS6.5安装Elasticsearch6.7.0问题及解决方案_第1张图片
创建用户

adduser abc
passwd abc
#设置密码,输入两遍

使用root账户对abc账户设置文件夹/usr/local/elasticsearch-6.7.0的操作权限

chown -R abc:abc /usr/local/elasticsearch-6.7.0

若abc账户没有操作权限, 启动时会报错

Exception in thread "main" java.nio.file.AccessDeniedException: /root/home/searchengine/elasticsearch-6.2.4/config/jvm.options
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.Files.newByteChannel(Files.java:361)
	at java.nio.file.Files.newByteChannel(Files.java:407)
	at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
	at java.nio.file.Files.newInputStream(Files.java:152)
	at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:58)

解压文件

tar -zxvf elasticsearch-6.7.0.tar.gz

解压后切换abc用户, 进入elasticsearch-6.7.0/bin文件夹中,执行以下命令启动elasticsearch

su abc
cd elasticsearch-6.7.0/bin
./elasticsearch

启动成功信息如下, 默认不修改配置文件时,启动端口为9200
CentOS6.5安装Elasticsearch6.7.0问题及解决方案_第2张图片
另外打开一个shell窗口,执行如下命令检测elasticsearch是否启动可用

curl localhost:9200

看到如下提示信息则启动成功!

[root@eshop-cache01 ~]# curl localhost:9200
{
  "name" : "1QlQqSA",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "W7En4K-tQGmW25gchCJ69w",
  "version" : {
    "number" : "6.7.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "8453f77",
    "build_date" : "2019-03-21T15:32:29.844721Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

安装启动过程中可能会出现一些问题:

1.缺少配置信息报错

ElasticsearchException[X-Pack is not supported and Machine Learning is not available for [windows-x86]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml]

在config/elasticsearch.yml添加一条配置:

 xpack.ml.enabled: false

注意在开头有一个空格, 在false和:之间有一个空格, 一定要加上,如果缺少冒号之后的空格会报错

Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ElasticsearchParseException[malformed, expected settings to start with 'object', instead was [VALUE_STRING]];

暂时记录这么几个问题, 问题完美修复!

你可能感兴趣的:(Elasticsearch)