LoginSignup
4
4

More than 5 years have passed since last update.

#elasticsearch CentOSでインストール、データとインデックスをみよう

Last updated at Posted at 2013-11-14

elasticsearchはじめました。
とても初心者的なステップバイステップをかいているので、達人さんには不要な情報です。

Macでやる場合も、CentOSでやる場合もtar.gzを解凍して、ディレクトリに配置して起動するのみです。
CentOSでやる場合は、デーモン化して起動する方法があったのでそうしています。

CentOSのバージョン

CentOS release 6.3 (Final)

elaticsearchのインストール

0.90.6でした。


wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.6.tar.gz

tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share

デーモン化して起動する


curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
sudo /usr/local/share/elasticsearch/bin/service/elasticsearch install

sudo /etc/init.d/elasticsearch start

elasticsearchのプラグインもインストールしておきましょう

/usr/local/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head

以下をアクセスすると、状態がみれます。

データをいれてみる

 curl -XPUT http://localhost:9200/bohebohe/test/1 -d '
  {
  "title":"bohebohe",
  "contents":"Hello World"
  }'

{"ok":true,"_index":"bohebohe","_type":"test","_id":"1","_version":1}

データのなかみ

logstash-2013.11.14はfluentdからアクセスログをいれてみました。

$ tree -d
.
└── elasticsearch
    └── nodes
        └── 0
            ├── _state
            └── indices
                ├── bohebohe
                │   ├── 0
                │   │   ├── _state
                │   │   ├── index
                │   │   └── translog
                │   ├── 1
                │   │   ├── _state
                │   │   ├── index
                │   │   └── translog
                │   ├── 2
                │   │   ├── _state
                │   │   ├── index
                │   │   └── translog
                │   ├── 3
                │   │   ├── _state
                │   │   ├── index
                │   │   └── translog
                │   ├── 4
                │   │   ├── _state
                │   │   ├── index
                │   │   └── translog
                │   └── _state
                └── logstash-2013.11.14
                    ├── 0
                    │   ├── _state
                    │   ├── index
                    │   └── translog
                    ├── 1
                    │   ├── _state
                    │   ├── index
                    │   └── translog
                    ├── 2
                    │   ├── _state
                    │   ├── index
                    │   └── translog
                    ├── 3
                    │   ├── _state
                    │   ├── index
                    │   └── translog
                    ├── 4
                    │   ├── _state
                    │   ├── index
                    │   └── translog
                    └── _state

49 directories

TODO

  • デーモンで9200で起動しているのですが、複数起動させたいのでその方法について
  • スキーマフリーといえども、スキーマの設定はしたほうがいいというので、その設定方法について

ステップ1くらいですかね。とりあえず残しておきます。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4