Giter Club home page Giter Club logo

ansible-elasticsearch's Introduction

ansible-elasticsearch

ansibleを使って、ログデータの収集と全文検索可能なマシンを構築します。
以下のソフトウェアをインストールします。
elasticsearch…ログデータのリアルタイム全文検索・分析エンジン cool. bonsai cool
kibana3…ログの可視化ソフトウェア
fluentd…ログデータの収集ソフトウェア

ansible...サーバ構成管理ソフトウェア

対象環境

CentOS 6.5 64bit (virtualbox + vagrantで構築)

実行環境

$ ansible --version  
ansible 1.4.1 (1.4.1 7bf799af65) last updated 2013/11/30 14:23:28 (GMT +900)

$ gem list |grep serverspec  
serverspec (0.13.7)

インストールするもの

  • elasticsearch (1.1.0)
  • plugin bigdesk
  • plugin head
  • kibana3
  • fluentd
  • nginx

使い方

  1. hostsファイルの設定変更
    clone後、hostsファイル内の対象サーバのIPアドレスを変更してください。

  2. SSH公開鍵認証の準備
    対象サーバにSSH公開鍵認証方式でログイン出来るように準備してください。

  3. ホスト名の変更
    サーバのホスト名を初期値es-server以外にする場合は、注意点1を参照し、
    あらかじめ変更してください。

  4. ansible playbook 実行
    次のコマンドで実行します。

$ ansible-playbook setup.yml -i hosts  

たまにyumで失敗することがありますが再度実行するとうまくいくことがあります。

  1. テストの実行
    次のコマンドで実行します。
$ rake serverspec:Install-Elasticsearch-Kibana
  1. 再起動
    ここで一度再起動してください。

  2. kibana3へのアクセス
    次のURLでアクセスできます。

http://IPアドレス/  

画面上部に次のエラーがでますが、elasticsearch上にデータがないとでるようです。

Error Could not find http://192.168.0.109:9200/_all/_mapping. If you are using a proxy, ensure it is configured correctly
  1. elasticsearchのプラグインbigdeskへのアクセス
    次のURLでアクセスできます。
http://IPアドレス:9200/_plugin/bigdesk  
  1. elasticsearchのプラグインheadへのアクセス
    次のURLでアクセスできます。
http://IPアドレス:9200/_plugin/head  

注意点

  1. サーバホスト名のハードコード
    いくつかの設定ファイルにサーバのホスト名をハードコードしています。
    (ホスト名未設定の場合にkibanaにうまくアクセスが出来ずハマりました。)
    実際に動かす際には、環境に合わせて変えてください。
    初期値ではes-serverです。
$ find ./  |xargs grep -n es-server  
./roles/es/templates/elasticsearch.yml:202:    network.bind_host: es-server  
./roles/nginx/templates/nginx.conf:4:          server_name           es-server;  
./roles/td-agent/templates/td-agent.conf:14:   host es-server  
./roles/kibana/vars/main.yml:3:                 servername: es-server  
  1. fluntdの収集先
    初期設定では、fluentdのログ収集先は/var/log/nginx/access.logにしています。
    つまり、構築後にkibanaに何度かアクセスすると、elascticsearchにログが保存されます。
    動作確認用なので、早めに設定を変えてください。

リンク

ansible-elasticsearch's People

Contributors

volanja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-elasticsearch's Issues

Submit roles to Galaxy?

Hi,

Recently we've released galaxy.ansibleworks.com which is a site that lets people share roles in Ansible with other users.

Would you be interested in submitting this content there so the community can find it?

(NOTE: if you content isn't already in role form, galaxy does require roles, and you should also update any legacy variables like $foo to {{ foo }} at this time as well)

If you are not interested that's totally fine, but I thought I would ask. (Feel free to delete this ticket).

Thanks very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.