2014年2月11日 星期二

Kibana Installation

Apache :
// download Kibana
$ cd /var/www
$ wget http://download.elasticsearch.org/kibana/kibana/kibana-latest.zip
$ unzip kibana-latest.zip

// setting
$ mv kibana-latest kibana
$ cd kibana
$ vi config.js
// Set the elasticsearch parameter to the fully qualified hostname of your Elasticsearch server

http://localhost/kibana-latest


ElasticSearch site plugin :
# cd /usr/share/elasticsearch
# bin/plugin -url http://download.elasticsearch.org/kibana/kibana/kibana-latest.zip -install elasticsearch/kibana3

http://localhost:9200/_plugin/kibana3


To Remove :
# cd /usr/share/elasticsearch
# bin/plugin --remove elasticsearch/kibana4




References :
Elasticsearch.org Kibana | Installation | Elasticsearch
elasticsearch/kibana
データ可視化に便利なkibanaは、elasticsearchのsiteプラグインとして構成すると便利 #fluentd - Y-Ken Studio

Elasticsearch installation


Debian / Ubuntu
$ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.11.deb
# dpkg -i elasticsearch-0.90.11.deb

CentOS
$ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.11.noarch.rpm
$ rpm -i elasticsearch-0.90.11.noarch.rpm

install path :
/usr/share/elasticsearch/bin





References :
Elasticsearch.org Download ELK | Elasticsearch 
Elasticsearch.org Announcing Deb And Rpm Repositories | Blog | Elasticsearch

2014年2月10日 星期一

EnvironmentError: mysql_config not found

# apt-get install libmysqlclient-dev

Install a package and write to requirements.txt with pip

$ pip freeze > requirements.txt
$ pip install -r requirements.txt
 
 
 
 
References :
Cookbook — pip 1.5.2 documentation 

Upload your package PyPI

PyPI — the Python Package Index


Create your accounts

PyPI Live 

PyPI Test


Create a .pypirc configuration file

[distutils] # this tells distutils what package indexes you can push to
    index-servers =
        PyPI # the live PyPI
        PyPI-test # test PyPI
 
    [PyPI] # authentication details for live PyPI
    repository: https://PyPI.python.org/PyPI
    username: {{your_username}}
    password: {{your_password}}
 
    [PyPI-test] # authentication details for test PyPI
    repository: https://testPyPI.python.org/PyPI
    username: {{your_username}}

Prepare your package

root-dir/   # arbitrary working directory name
        setup.py
        setup.cfg
        LICENSE.txt
        README.md
        mypackage/
            __init__.py
            foo.py
            bar.py
            baz.py

setup.py
from distutils.core import setup
    setup(
        name = 'mypackage',
        packages = ['mypackage'], # this must be the same as the name above
        version = '0.1',
        description = 'A random test lib',
        author = 'Ajay',
        author_email = 'aj@gmail.com',
        url = 'https://github.com/ajkumar25/mypackage',   # use the URL to the github repo
        download_url = 'https://github.com/ajkumar25/mypackage/tarball/0.1', # I'll explain this in a second
        keywords = ['testing', 'logging', 'example'], # arbitrary keywords
        classifiers = [],
    )

setup.cfg
[metadata]
description-file = README.md

Register your package

$ python setup.py register -r PyPI-test

 

Upload your package

Upload to PyPI Test

$ python setup.py sdist upload -r PyPI-test

Upload to PyPI Live

$ python setup.py register -r PyPI

$ python setup.py sdist upload -r PyPI




References :
How to Create a Python Library | Pypix

 

2014年2月8日 星期六

Dump database to csv format

SELECT *FROM the_tableINTO OUTFILE '/tmp/the_table.csv'FIELDS TERMINATED BY ','ENCLOSED BY '"'LINES TERMINATED BY '\n';




References:
Save MySQL query results into a text or CSV file | a Tech-Recipes Tutorial