我在樱花的VPS上安装了CentOS 7(x86_64)和elasticsearch
成为根源。
● 安装 Java
yum install java
java -version
版本显示会如下所示。
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-b16)
OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)
●安装Elasticsearch
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
vim /etc/yum.repos.d/elasticsearch.repo
创建一个新文件,其内容如下所述。
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
执行下面的命令。
yum install elasticsearch
systemctl enable elasticsearch
systemctl start elasticsearch
curl localhost:9200
[root@tk2-259-39318 ~]# curl localhost:9200
{
"name" : "skdoA54",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "ERp54wHgQxamJAXrpncmCA",
"version" : {
"number" : "5.5.2",
"build_hash" : "b2f0c09",
"build_date" : "2017-08-14T12:33:14.154Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
●安装Kuromoji
/usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-kuromoji
如果显示已安装了analysis-kuromoji,那就没问题。
systemctl restart elasticsearch
当连接到本地主机失败时,会显示“拒绝连接”。
vi /etc/elasticsearch/elasticsearch.yml
network.host: "localhost"
http.port: 9200
systemctl restart elasticsearch