前回インストールした1.7.3だと古いので、最新版の2.2.1をインストールしなおす。
1 2 3 4 |
$ mkdir centos-7.1-elasticsearch $ cd centos-7.1-elasticsearch $ vagrant init centos-7.1 $ vagrant up |
Javaのインストール
1 2 3 4 5 6 |
$ sudo yum update -y $ sudo yum install java-1.8.0-openjdk -y $ java -version openjdk version "1.8.0_71" OpenJDK Runtime Environment (build 1.8.0_71-b15) OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode) |
Elasticreserchのインストール
1 2 3 4 |
$ wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.2.1/elasticsearch-2.2.1.rpm $ sudo rpm -ivh elasticsearch-2.2.1.rpm $ sudo systemctl daemon-reload $ sudo systemctl enable elasticsearch.service |
Elasticsearchの設定
/etc/elasticsearch/elasticsearch.yml
1 |
network.host: [127.0.0.1, 192.168.33.10] |
ローカルホストに加えて、VagrantのホストOS側からのアクセスも許す
Elasticsearchの実行
1 |
$ sudo service elasticsearch start |
ざっくり動作確認
まずはローカルホストのシェルから
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ curl -X GET 'http://localhost:9200' { "name" : "Hyde", "cluster_name" : "elasticsearch", "version" : { "number" : "2.2.1", "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1", "build_timestamp" : "2016-03-09T09:38:54Z", "build_snapshot" : false, "lucene_version" : "5.4.1" }, "tagline" : "You Know, for Search" } |
次にホストOSのブラウザから
1 2 3 4 5 6 7 8 9 10 11 12 13 |
http://192.168.33.10:9200/ { "name" : "Hyde", "cluster_name" : "elasticsearch", "version" : { "number" : "2.2.1", "build_hash" : "d045fc29d1932bce18b2e65ab8b297fbf6cd41a1", "build_timestamp" : "2016-03-09T09:38:54Z", "build_snapshot" : false, "lucene_version" : "5.4.1" }, "tagline" : "You Know, for Search" } |