Skip to content

Instantly share code, notes, and snippets.

Install flume on ubuntu

http://hadooptutorial.info/apache-flume-installation/

###Step 1 : Загружаем bin файл флюма http://flume.apache.org/download.html ###Step 2 : поочередно выполняем нижеприведенные строки кода: $ sudo mkdir /usr/lib/flume $ sudo chmod -R 777 /usr/lib/flume

выпадающий текст после нажатия на линк

in some_viwe_file.html.haml

.home-services
  %a{"data-toggle-selector" => "#me", :href => "#"}
    some link name

  #me{class: "cont"}
    %p
      Some text

Elasticsearch sort by id

По умолчанию elascticsearch (ES) НЕ индексирует (отдельно) и НЕ сортирует записи по полю _id. Значения для _id вытаскиваются из поля _uid

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html

Вместо этого он индексирует поле _uid, которое и содержит в себе информацию об _id и _type в виде {type}#{id}

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-uid-field.html

Сортировка же по полю _uid является некорректной в виду того, что _id в нем является не integer, а string объектом.

Elasticsearch range by date

Для того, чтобы модель сортировалась в пределах определенного временного отрезка, мы должны передать в ES строку такого вида "2015-01-01T12:10:30Z"

example

module ElasticsearchSearchable
  extend ActiveSupport::Concern
  
  included do
    ...

install elasticsearch

http://itc-life.ru/fluentd-bystryj-poisk-logov-s-elasticsearch-kibana-and-fluentd/

$ `sudo wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.1/elasticsearch-2.3.1.deb`
$ `sudo dpkg -i elasticsearch-2.3.1.deb`

После установки добавляем в автозапуск

$ `sudo update-rc.d elasticsearch defaults 95 10`
$ `sudo /bin/systemctl daemon-reload`

для мастер-машины

(на которую будут приходить логи с нод-машин)

перед этим устанавливаем elasticsearch and kibana

https://gist.github.com/elvisgiv/cf83570c79da80bec326d2bdd454980d

https://gist.github.com/elvisgiv/e32d1c043df4e38594c6bbd10044548d

Установка Fluentd

(from: http://itc-life.ru/fluentd-bystryj-poisk-logov-s-elasticsearch-kibana-and-fluentd) (from: http://www.fluentd.org/guides/recipes/elasticsearch-and-s3)

flume from kafka to elasticsearch config

flume config

# Name the components on this agent
a1.sources = kafka-source-1
a1.sinks = k1
a1.channels = c1

# Use a channel which buffers events in memory
a1.channels.c1.type=memory