elasticsearch curator検証

elasticsearch 1.3.8
curator 3.2.0
で動くか検証

## 検証用のdockerコンテナ作成
```
$ docker run --name elastic -h elastic -t -i -p 9200:9200 -p 5601:5601 centos:centos6 /bin/bash
[root@elastic /]# 
```

## 事前準備
jdk入れる

```
[root@elastic /]# yum install -y java-1.7.0-openjdk
〜中略〜
Installed:
  java-1.7.0-openjdk.x86_64 1:1.7.0.79-2.5.5.3.el6_6                                                                                                                                

Dependency Installed:
  ConsoleKit.x86_64 0:0.4.1-3.el6            ConsoleKit-libs.x86_64 0:0.4.1-3.el6       GConf2.x86_64 0:2.28.0-6.el6                 ORBit2.x86_64 0:2.14.17-5.el6                
  alsa-lib.x86_64 0:1.0.22-3.el6             atk.x86_64 0:1.30.0-1.el6                  avahi-libs.x86_64 0:0.6.25-15.el6            cairo.x86_64 0:1.8.8-6.el6_6                 
  cups-libs.x86_64 1:1.4.2-67.el6_6.1        dbus.x86_64 1:1.2.24-8.el6_6               eggdbus.x86_64 0:0.6-3.el6                   flac.x86_64 0:1.2.1-7.el6_6                  
  fontconfig.x86_64 0:2.8.0-5.el6            freetype.x86_64 0:2.3.11-15.el6_6.1        gdk-pixbuf2.x86_64 0:2.24.1-5.el6            giflib.x86_64 0:4.1.6-3.1.el6                
  gnutls.x86_64 0:2.8.5-14.el6_5             gtk2.x86_64 0:2.24.23-6.el6                hicolor-icon-theme.noarch 0:0.11-1.1.el6     jasper-libs.x86_64 0:1.900.1-16.el6_6.3      
  jpackage-utils.noarch 0:1.7.5-3.12.el6     libICE.x86_64 0:1.0.6-1.el6                libIDL.x86_64 0:0.8.13-2.1.el6               libSM.x86_64 0:1.2.1-2.el6                   
  libX11.x86_64 0:1.6.0-2.2.el6              libX11-common.noarch 0:1.6.0-2.2.el6       libXau.x86_64 0:1.0.6-4.el6                  libXcomposite.x86_64 0:0.4.3-4.el6           
  libXcursor.x86_64 0:1.1.14-2.1.el6         libXdamage.x86_64 0:1.1.3-4.el6            libXext.x86_64 0:1.3.2-2.1.el6               libXfixes.x86_64 0:5.0.1-2.1.el6             
  libXfont.x86_64 0:1.4.5-4.el6_6            libXft.x86_64 0:2.3.1-2.el6                libXi.x86_64 0:1.7.2-2.2.el6                 libXinerama.x86_64 0:1.1.3-2.1.el6           
  libXrandr.x86_64 0:1.4.1-2.1.el6           libXrender.x86_64 0:0.9.8-2.1.el6          libXtst.x86_64 0:1.2.2-2.1.el6               libasyncns.x86_64 0:0.8-1.1.el6              
  libcap-ng.x86_64 0:0.6.4-3.el6_0.1         libfontenc.x86_64 0:1.0.5-2.el6            libjpeg-turbo.x86_64 0:1.2.1-3.el6_5         libogg.x86_64 2:1.1.4-2.1.el6                
  libpng.x86_64 2:1.2.49-1.el6_2             libsndfile.x86_64 0:1.0.20-5.el6           libthai.x86_64 0:0.1.12-3.el6                libtiff.x86_64 0:3.9.4-10.el6_5              
  libvorbis.x86_64 1:1.2.3-4.el6_2.1         libxcb.x86_64 0:1.9.1-2.el6                pango.x86_64 0:1.28.1-10.el6                 pixman.x86_64 0:0.32.4-4.el6                 
  polkit.x86_64 0:0.96-7.el6                 pulseaudio-libs.x86_64 0:0.9.21-17.el6     sgml-common.noarch 0:0.6.3-33.el6            tcp_wrappers-libs.x86_64 0:7.6-57.el6        
  ttmkfdir.x86_64 0:3.0.9-32.1.el6           tzdata-java.noarch 0:2015e-1.el6           xorg-x11-font-utils.x86_64 1:7.2-11.el6      xorg-x11-fonts-Type1.noarch 0:7.2-9.1.el6    

Dependency Updated:
  dbus-libs.x86_64 1:1.2.24-8.el6_6                                                                                                                                                 

Complete!
```

whichコマンド入れる（ESの起動スクリプトで使ってる）

```
[root@elastic ~]# yum install -y which
〜中略〜
Installed:
  which.x86_64 0:2.19-6.el6                                                                                                                                                         

Complete!
```

## GPG-KEYインポート
```
[root@elastic /]# rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
```

## elasticsearch用リポジトリ設定
Version1.3系のリポジトリ

```
[root@elastic /]# vi /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-1.3]
name=Elasticsearch repository for 1.3.x packages
baseurl=http://packages.elastic.co/elasticsearch/1.3/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
```

## elasticsearchインストール
1.3.8指定でインストール

```
[root@elastic /]# yum install -y elasticsearch-1.3.8
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package elasticsearch.noarch 0:1.3.8-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                                      Arch                                  Version                                  Repository                                        Size
====================================================================================================================================================================================
Installing:
 elasticsearch                                noarch                                1.3.8-1                                  elasticsearch-1.3                                 26 M

Transaction Summary
====================================================================================================================================================================================
Install       1 Package(s)

Total download size: 26 M
Installed size: 29 M
Downloading Packages:
elasticsearch-1.3.8.noarch.rpm                                                                                                                               |  26 MB     01:23     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : elasticsearch-1.3.8-1.noarch                                                                                                                                     1/1 
### NOT starting on installation, please execute the following statements to configure elasticsearch to start automatically using chkconfig
 sudo /sbin/chkconfig --add elasticsearch
### You can start elasticsearch by executing
 sudo service elasticsearch start
  Verifying  : elasticsearch-1.3.8-1.noarch                                                                                                                                     1/1 

Installed:
  elasticsearch.noarch 0:1.3.8-1                                                                                                                                                    

Complete!
```

## elasticsearch起動確認
/etc/elasticsearch/elasticsearch.ymlを適宜書き換えて、起動

```
[root@elastic ~]# /etc/init.d/elasticsearch start
error: "Read-only file system" setting key "vm.max_map_count"
Starting elasticsearch:                                    [  OK  ]
[root@elastic ~]# echo $?
0
[root@elastic ~]# curl http://localhost:9200/
{
  "status" : 200,
  "name" : "elastic_test_1",
  "version" : {
    "number" : "1.3.8",
    "build_hash" : "475733ee0837fba18c00c3ee76cd49a08755550c",
    "build_timestamp" : "2015-02-11T14:45:42Z",
    "build_snapshot" : false,
    "lucene_version" : "4.9"
  },
  "tagline" : "You Know, for Search"
}
```

## curator用リポジトリ設定

```
[root@elastic ~]# vi /etc/yum.repos.d/curator.repo
[curator-3]
name=CentOS/RHEL 6 repository for Elasticsearch Curator 3.x packages
baseurl=http://packages.elasticsearch.org/curator/3/centos/6
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
```

## epelの設定

```
[root@elastic ~]# yum install -y epel-release
〜中略〜
Installed:
  epel-release.noarch 0:6-8                                                                                                                                                         

Complete!

```

## curator インストール
pythonのモジュールも、もろもろもインストール

```
[root@elastic ~]# yum install -y python-setuptools
〜中略〜
Installed:
  python-setuptools.noarch 0:18.0.1-1                                                                                                                                               

Complete!


[root@elastic ~]# yum install -y python-elasticsearch-curator
〜中略〜
Installed:
  python-elasticsearch-curator.noarch 0:3.2.2-1                                                                                                                                     

Dependency Installed:
  python-click.noarch 0:4.0-1           python-elasticsearch.noarch 0:1.6.0-1           python-unittest2.noarch 0:0.5.1-3.el6           python-urllib3.noarch 0:1.10.4-1          

Complete!
```

## 動作確認

```
[root@elastic ~]# curator --host localhost --port 9200 show indices --all-indices
2015-07-14 10:26:59,073 INFO      Job starting: show indices
2015-07-14 10:26:59,083 INFO      Matching all indices. Ignoring flags other than --exclude.
2015-07-14 10:26:59,083 INFO      Matching indices:
sampleindex
```

curator 1.2.2とはオプションがだいぶ変わった模様ですが、一応動きそうです。