Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

вектор, призначеної для збору, перетворення та відправлення даних логів, метрик та подій.

→ Github

Будучи написаною мовою Rust, вона відрізняється високою продуктивністю та низьким споживанням оперативної пам'яті порівняно з аналогами. Крім того, велика увага приділена функціям, пов'язаним з коректністю, зокрема можливостям збереження невідправлених подій у буфер на диску та ротації файлів.

Архітектурно Vector є роутером подій, що приймає повідомлення з одного чи кількох джерел, що опціонально застосовує над цими повідомленнями перетворенняі відправляють їх в один або кілька стоків.

Vector - це заміна файлів beat і logstash, він може виступати в обох ролях (отримувати і відправляти логи), більш докладно на них сайті.

Якщо в Logstash ланцюжок будується як input → filter → output то в Vector це джерелперетвореннямийки

Приклади можна переглянути в документації.

Ця інструкція перероблена інстукція від В'ячеслава Рахінського. В оригінальній інструкції є обробка geoip. У мене при тестуванні geoip із внутрішньої мережі, vector видавав помилку.

Aug 05 06:25:31.889 DEBUG transform{name=nginx_parse_rename_fields type=rename_fields}: vector::transforms::rename_fields: Field did not exist field=«geoip.country_name» rate_limit_secs=30

Якщо комусь потрібно обробляти geoip, зверніться до оригінальної інструкції від В'ячеслава Рахінського.

Налаштовуватимемо зв'язку Nginx (Access logs) → Vector (Client | Filebeat) → Vector (Server | Logstash) → окремо в Clickhouse і окремо Elasticsearch. Встановимо 4 сервери. Хоча можна обійти 3 серверами.

Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

Схема приблизно така.

Вимикаємо Selinux на всіх ваших серверах

sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
reboot

На всі сервери встановлюємо емулятор HTTP сервера + утиліти

Як емулятор HTTP сервера будемо використовувати nodejs-stub-server від Maxim Ignatenko

Nodejs-stub-server не має rpm. Тут створюємо йому rpm. Збиратиметься rpm за допомогою Fedora Copr

Додаємо репозиторій antonpatsev/nodejs-stub-server

yum -y install yum-plugin-copr epel-release
yes | yum copr enable antonpatsev/nodejs-stub-server

Встановлюємо nodejs-stub-server, Apache benchmark та термінальний мультиплексор screen на всі сервери

yum -y install stub_http_server screen mc httpd-tools screen

Поправив у файлі /var/lib/stub_http_server/stub_http_server.js час відповіді stub_http_server щоб було більше логів.

var max_sleep = 10;

Запустимо stub_http_server.

systemctl start stub_http_server
systemctl enable stub_http_server

Установка Clickhouse на 3 сервері

ClickHouse використовують набір інструкцій SSE 4.2, тому, якщо не вказано інше, його підтримка у процесорі, що використовується, стає додатковою вимогою до системи. Ось команда, щоб перевірити, чи підтримує поточний процесор SSE 4.2:

grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"

Спочатку потрібно підключити офіційний репозиторій:

sudo yum install -y yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64

Для встановлення пакетів необхідно виконати такі команди:

sudo yum install -y clickhouse-server clickhouse-client

Дозволяємо clickhouse-server слухати мережну картку у файлі /etc/clickhouse-server/config.xml

<listen_host>0.0.0.0</listen_host>

Змінюємо рівень логування з trace до debug

відлагоджувати

Налаштування стандартного стиснення:

min_compress_block_size  65536
max_compress_block_size  1048576

Для активації Zstd очікування конфіг порадили не чіпати, а краще застосовувати DDL.

Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

Як застосувати zstd стиснення через DDL в кути я не знайшов. Тож залишив як є.

Колеги, хто використовує стиснення zstd в Clickhouse — поділити, будь ласка, інструкціями.

Для запуску сервера як демон, виконайте:

service clickhouse-server start

Тепер перейдемо до налаштування Clickhouse

Заходимо до Clickhouse

clickhouse-client -h 172.26.10.109 -m

172.26.10.109 - IP сервера де встановлений Clickhouse.

Створимо БД vector

CREATE DATABASE vector;

Перевіримо, що бд є.

show databases;

Створюємо таблицю vector.logs.

/* Это таблица где хранятся логи как есть */

CREATE TABLE vector.logs
(
    `node_name` String,
    `timestamp` DateTime,
    `server_name` String,
    `user_id` String,
    `request_full` String,
    `request_user_agent` String,
    `request_http_host` String,
    `request_uri` String,
    `request_scheme` String,
    `request_method` String,
    `request_length` UInt64,
    `request_time` Float32,
    `request_referrer` String,
    `response_status` UInt16,
    `response_body_bytes_sent` UInt64,
    `response_content_type` String,
    `remote_addr` IPv4,
    `remote_port` UInt32,
    `remote_user` String,
    `upstream_addr` IPv4,
    `upstream_port` UInt32,
    `upstream_bytes_received` UInt64,
    `upstream_bytes_sent` UInt64,
    `upstream_cache_status` String,
    `upstream_connect_time` Float32,
    `upstream_header_time` Float32,
    `upstream_response_length` UInt64,
    `upstream_response_time` Float32,
    `upstream_status` UInt16,
    `upstream_content_type` String,
    INDEX idx_http_host request_http_host TYPE set(0) GRANULARITY 1
)
ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(timestamp)
ORDER BY timestamp
TTL timestamp + toIntervalMonth(1)
SETTINGS index_granularity = 8192;

Перевіряємо, що створилися таблиці. Запускаємо clickhouse-client та робимо запит.

Переходимо до бд vector.

use vector;

Ok.

0 rows in set. Elapsed: 0.001 sec.

Дивимося таблиці.

show tables;

┌─name────────────────┐
│ logs                │
└─────────────────────┘

Установка elasticsearch на 4-му сервері для надсилання тих же даних в Elasticsearch для порівняння з Clickhouse

Додамо публічний rpm ключ

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Створимо 2 репо:

/etc/yum.repos.d/elasticsearch.repo

[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md

/etc/yum.repos.d/kibana.repo

[kibana-7.x]
name=Kibana repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Встановимо elasticsearch і kibana

yum install -y kibana elasticsearch

Так як буде в 1 екземплярі, то файл /etc/elasticsearch/elasticsearch.yml потрібно додати:

discovery.type: single-node

Щоб вектор зміг відправляти дані в еластичномудослідженні з іншого сервера змінити network.host.

network.host: 0.0.0.0

Щоб підключитися до kibana змінимо параметр server.host у файл /etc/kibana/kibana.yml

server.host: "0.0.0.0"

Стараємо і включаємо в автозапуск еластичнийдовід

systemctl enable elasticsearch
systemctl start elasticsearch

та kibana

systemctl enable kibana
systemctl start kibana

Налаштування Elasticsearch для 1-кодового режиму 0 shard, XNUMX replica. Швидше за все у вас буде кластер з великої кількості серверів і вам це робити не потрібно.

Для майбутніх індексів оновлюємо шаблон за промовчанням:

curl -X PUT http://localhost:9200/_template/default -H 'Content-Type: application/json' -d '{"index_patterns": ["*"],"order": -1,"settings": {"number_of_shards": "1","number_of_replicas": "0"}}' 

Встановлення вектор як заміну Logstash на 2 сервері

yum install -y https://packages.timber.io/vector/0.9.X/vector-x86_64.rpm mc httpd-tools screen

Налаштуємо Vector як заміну Logstash. Редагуємо файл /etc/vector/vector.toml

# /etc/vector/vector.toml

data_dir = "/var/lib/vector"

[sources.nginx_input_vector]
  # General
  type                          = "vector"
  address                       = "0.0.0.0:9876"
  shutdown_timeout_secs         = 30

[transforms.nginx_parse_json]
  inputs                        = [ "nginx_input_vector" ]
  type                          = "json_parser"

[transforms.nginx_parse_add_defaults]
  inputs                        = [ "nginx_parse_json" ]
  type                          = "lua"
  version                       = "2"

  hooks.process = """
  function (event, emit)

    function split_first(s, delimiter)
      result = {};
      for match in (s..delimiter):gmatch("(.-)"..delimiter) do
          table.insert(result, match);
      end
      return result[1];
    end

    function split_last(s, delimiter)
      result = {};
      for match in (s..delimiter):gmatch("(.-)"..delimiter) do
          table.insert(result, match);
      end
      return result[#result];
    end

    event.log.upstream_addr             = split_first(split_last(event.log.upstream_addr, ', '), ':')
    event.log.upstream_bytes_received   = split_last(event.log.upstream_bytes_received, ', ')
    event.log.upstream_bytes_sent       = split_last(event.log.upstream_bytes_sent, ', ')
    event.log.upstream_connect_time     = split_last(event.log.upstream_connect_time, ', ')
    event.log.upstream_header_time      = split_last(event.log.upstream_header_time, ', ')
    event.log.upstream_response_length  = split_last(event.log.upstream_response_length, ', ')
    event.log.upstream_response_time    = split_last(event.log.upstream_response_time, ', ')
    event.log.upstream_status           = split_last(event.log.upstream_status, ', ')

    if event.log.upstream_addr == "" then
        event.log.upstream_addr = "127.0.0.1"
    end

    if (event.log.upstream_bytes_received == "-" or event.log.upstream_bytes_received == "") then
        event.log.upstream_bytes_received = "0"
    end

    if (event.log.upstream_bytes_sent == "-" or event.log.upstream_bytes_sent == "") then
        event.log.upstream_bytes_sent = "0"
    end

    if event.log.upstream_cache_status == "" then
        event.log.upstream_cache_status = "DISABLED"
    end

    if (event.log.upstream_connect_time == "-" or event.log.upstream_connect_time == "") then
        event.log.upstream_connect_time = "0"
    end

    if (event.log.upstream_header_time == "-" or event.log.upstream_header_time == "") then
        event.log.upstream_header_time = "0"
    end

    if (event.log.upstream_response_length == "-" or event.log.upstream_response_length == "") then
        event.log.upstream_response_length = "0"
    end

    if (event.log.upstream_response_time == "-" or event.log.upstream_response_time == "") then
        event.log.upstream_response_time = "0"
    end

    if (event.log.upstream_status == "-" or event.log.upstream_status == "") then
        event.log.upstream_status = "0"
    end

    emit(event)

  end
  """

[transforms.nginx_parse_remove_fields]
    inputs                              = [ "nginx_parse_add_defaults" ]
    type                                = "remove_fields"
    fields                              = ["data", "file", "host", "source_type"]

[transforms.nginx_parse_coercer]

    type                                = "coercer"
    inputs                              = ["nginx_parse_remove_fields"]

    types.request_length = "int"
    types.request_time = "float"

    types.response_status = "int"
    types.response_body_bytes_sent = "int"

    types.remote_port = "int"

    types.upstream_bytes_received = "int"
    types.upstream_bytes_send = "int"
    types.upstream_connect_time = "float"
    types.upstream_header_time = "float"
    types.upstream_response_length = "int"
    types.upstream_response_time = "float"
    types.upstream_status = "int"

    types.timestamp = "timestamp"

[sinks.nginx_output_clickhouse]
    inputs   = ["nginx_parse_coercer"]
    type     = "clickhouse"

    database = "vector"
    healthcheck = true
    host = "http://172.26.10.109:8123" #  Адрес Clickhouse
    table = "logs"

    encoding.timestamp_format = "unix"

    buffer.type = "disk"
    buffer.max_size = 104900000
    buffer.when_full = "block"

    request.in_flight_limit = 20

[sinks.elasticsearch]
    type = "elasticsearch"
    inputs   = ["nginx_parse_coercer"]
    compression = "none"
    healthcheck = true
    # 172.26.10.116 - сервер где установен elasticsearch
    host = "http://172.26.10.116:9200" 
    index = "vector-%Y-%m-%d"

Ви можете відкоригувати розділ transforms.nginx_parse_add_defaults.

Так як В'ячеслав Рахінський використовує дані конфіги для невеликого CDN і там upstream_* може прилітати кілька значень

Наприклад:

"upstream_addr": "128.66.0.10:443, 128.66.0.11:443, 128.66.0.12:443"
"upstream_bytes_received": "-, -, 123"
"upstream_status": "502, 502, 200"

Якщо це не ваша ситуація, то цю секцію можна спростити

Створимо налаштування service для systemd /etc/systemd/system/vector.service

# /etc/systemd/system/vector.service

[Unit]
Description=Vector
After=network-online.target
Requires=network-online.target

[Service]
User=vector
Group=vector
ExecStart=/usr/bin/vector
ExecReload=/bin/kill -HUP $MAINPID
Restart=no
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=vector

[Install]
WantedBy=multi-user.target

Після створення таблиць можна запускати Vector

systemctl enable vector
systemctl start vector

Логи vector можна подивитись так

journalctl -f -u vector

У логах мають бути такі записи

INFO vector::topology::builder: Healthcheck: Passed.
INFO vector::topology::builder: Healthcheck: Passed.

На клієнті (Web server) - 1-й сервер

На сервері з nginx необхідно вимкнути ipv6, тому що в таблиці logs у clickhouse використовується поле upstream_addr IPv4, тому що я не використовую ipv6 всередині мережі. Якщо ipv6 не вимкнути, то будуть помилки:

DB::Exception: Invalid IPv4 value.: (while read the value of key upstream_addr)

Можливо, читачі, додавати підтримку ipv6.

Створюємо файл /etc/sysctl.d/98-disable-ipv6.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Застосовуємо налаштування

sysctl --system

Встановимо nginx.

Додав файл репозиторію nginx /etc/yum.repos.d/nginx.repo

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

Встановимо пакет nginx

yum install -y nginx

Для початку нам потрібно налаштувати формат логів у Nginx у файлі /etc/nginx/nginx.conf

user  nginx;
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically

# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

# provides the configuration file context in which the directives that affect connection processing are specified.
events {
    # determines how much clients will be served per worker
    # max clients = worker_connections * worker_processes
    # max clients is also limited by the number of socket connections available on the system (~64k)
    worker_connections 4000;

    # optimized to serve many clients with each thread, essential for linux -- for testing environment
    use epoll;

    # accept as many connections as possible, may flood worker connections if set too low -- for testing environment
    multi_accept on;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

log_format vector escape=json
    '{'
        '"node_name":"nginx-vector",'
        '"timestamp":"$time_iso8601",'
        '"server_name":"$server_name",'
        '"request_full": "$request",'
        '"request_user_agent":"$http_user_agent",'
        '"request_http_host":"$http_host",'
        '"request_uri":"$request_uri",'
        '"request_scheme": "$scheme",'
        '"request_method":"$request_method",'
        '"request_length":"$request_length",'
        '"request_time": "$request_time",'
        '"request_referrer":"$http_referer",'
        '"response_status": "$status",'
        '"response_body_bytes_sent":"$body_bytes_sent",'
        '"response_content_type":"$sent_http_content_type",'
        '"remote_addr": "$remote_addr",'
        '"remote_port": "$remote_port",'
        '"remote_user": "$remote_user",'
        '"upstream_addr": "$upstream_addr",'
        '"upstream_bytes_received": "$upstream_bytes_received",'
        '"upstream_bytes_sent": "$upstream_bytes_sent",'
        '"upstream_cache_status":"$upstream_cache_status",'
        '"upstream_connect_time":"$upstream_connect_time",'
        '"upstream_header_time":"$upstream_header_time",'
        '"upstream_response_length":"$upstream_response_length",'
        '"upstream_response_time":"$upstream_response_time",'
        '"upstream_status": "$upstream_status",'
        '"upstream_content_type":"$upstream_http_content_type"'
    '}';

    access_log  /var/log/nginx/access.log  main;
    access_log  /var/log/nginx/access.json.log vector;      # Новый лог в формате json

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

Щоб не поламати вашу поточну конфігурацію, Nginx дозволяє мати кілька директив access_log

access_log  /var/log/nginx/access.log  main;            # Стандартный лог
access_log  /var/log/nginx/access.json.log vector;      # Новый лог в формате json

Не забудьте додати правило до logrotate для нових логів (якщо log фаїл не закінчується на .log)

Видаляємо default.conf з /etc/nginx/conf.d/

rm -f /etc/nginx/conf.d/default.conf

Додаємо віртуальний хост /etc/nginx/conf.d/vhost1.conf

server {
    listen 80;
    server_name vhost1;
    location / {
        proxy_pass http://172.26.10.106:8080;
    }
}

Додаємо віртуальний хост /etc/nginx/conf.d/vhost2.conf

server {
    listen 80;
    server_name vhost2;
    location / {
        proxy_pass http://172.26.10.108:8080;
    }
}

Додаємо віртуальний хост /etc/nginx/conf.d/vhost3.conf

server {
    listen 80;
    server_name vhost3;
    location / {
        proxy_pass http://172.26.10.109:8080;
    }
}

Додаємо віртуальний хост /etc/nginx/conf.d/vhost4.conf

server {
    listen 80;
    server_name vhost4;
    location / {
        proxy_pass http://172.26.10.116:8080;
    }
}

Додаємо у файл /etc/hosts віртуальні хости (172.26.10.106 ip сервери де встановлений nginx) на всі сервери:

172.26.10.106 vhost1
172.26.10.106 vhost2
172.26.10.106 vhost3
172.26.10.106 vhost4

І якщо все готове, то

nginx -t 
systemctl restart nginx

Тепер встановимо сам вектор

yum install -y https://packages.timber.io/vector/0.9.X/vector-x86_64.rpm

Створимо фаїл налаштувань для systemd /etc/systemd/system/vector.service

[Unit]
Description=Vector
After=network-online.target
Requires=network-online.target

[Service]
User=vector
Group=vector
ExecStart=/usr/bin/vector
ExecReload=/bin/kill -HUP $MAINPID
Restart=no
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=vector

[Install]
WantedBy=multi-user.target

І налаштуємо заміну Filebeat у конфізі /etc/vector/vector.toml. IP адреса 172.26.10.108 - це IP адреса log сервера (Vector-Server)

data_dir = "/var/lib/vector"

[sources.nginx_file]
  type                          = "file"
  include                       = [ "/var/log/nginx/access.json.log" ]
  start_at_beginning            = false
  fingerprinting.strategy       = "device_and_inode"

[sinks.nginx_output_vector]
  type                          = "vector"
  inputs                        = [ "nginx_file" ]

  address                       = "172.26.10.108:9876"

Не забудьте додати користувача vector в необхідну групу що він міг читати log файли. Наприклад, nginx у centos створює логи з правами групи adm.

usermod -a -G adm vector

Запустимо сервіс vector

systemctl enable vector
systemctl start vector

Логи vector можна подивитись так

journalctl -f -u vector

У логах має бути такий запис

INFO vector::topology::builder: Healthcheck: Passed.

Тестування навантаження

Тестування проводимо за допомогою Apache benchmark.

На всі сервери було встановлено пакет httpd-tools

Запускаємо тестування за допомогою Apache benchmark c 4 різних серверів у screen. Спочатку запускаємо термінальний мультиплексор screen, а потім запускаємо тестування за допомогою Apache benchmark. Як працювати з screen ви можете знайти в статті.

З 1-го сервера

while true; do ab -H "User-Agent: 1server" -c 100 -n 10 -t 10 http://vhost1/; sleep 1; done

З 2-го сервера

while true; do ab -H "User-Agent: 2server" -c 100 -n 10 -t 10 http://vhost2/; sleep 1; done

З 3-го сервера

while true; do ab -H "User-Agent: 3server" -c 100 -n 10 -t 10 http://vhost3/; sleep 1; done

З 4-го сервера

while true; do ab -H "User-Agent: 4server" -c 100 -n 10 -t 10 http://vhost4/; sleep 1; done

Перевіримо дані у Clickhouse

Заходимо до Clickhouse

clickhouse-client -h 172.26.10.109 -m

Робимо SQL запит

SELECT * FROM vector.logs;

┌─node_name────┬───────────timestamp─┬─server_name─┬─user_id─┬─request_full───┬─request_user_agent─┬─request_http_host─┬─request_uri─┬─request_scheme─┬─request_method─┬─request_length─┬─request_time─┬─request_referrer─┬─response_status─┬─response_body_bytes_sent─┬─response_content_type─┬───remote_addr─┬─remote_port─┬─remote_user─┬─upstream_addr─┬─upstream_port─┬─upstream_bytes_received─┬─upstream_bytes_sent─┬─upstream_cache_status─┬─upstream_connect_time─┬─upstream_header_time─┬─upstream_response_length─┬─upstream_response_time─┬─upstream_status─┬─upstream_content_type─┐
│ nginx-vector │ 2020-08-07 04:32:42 │ vhost1      │         │ GET / HTTP/1.0 │ 1server            │ vhost1            │ /           │ http           │ GET            │             66 │        0.028 │                  │             404 │                       27 │                       │ 172.26.10.106 │       45886 │             │ 172.26.10.106 │             0 │                     109 │                  97 │ DISABLED              │                     0 │                0.025 │                       27 │                  0.029 │             404 │                       │
└──────────────┴─────────────────────┴─────────────┴─────────┴────────────────┴────────────────────┴───────────────────┴─────────────┴────────────────┴────────────────┴────────────────┴──────────────┴──────────────────┴─────────────────┴──────────────────────────┴───────────────────────┴───────────────┴─────────────┴─────────────┴───────────────┴───────────────┴─────────────────────────┴─────────────────────┴───────────────────────┴───────────────────────┴──────────────────────┴──────────────────────────┴────────────────────────┴─────────────────┴───────────────────────

Дізнаємося розмір таблиць у Clickhouse

select concat(database, '.', table)                         as table,
       formatReadableSize(sum(bytes))                       as size,
       sum(rows)                                            as rows,
       max(modification_time)                               as latest_modification,
       sum(bytes)                                           as bytes_size,
       any(engine)                                          as engine,
       formatReadableSize(sum(primary_key_bytes_in_memory)) as primary_keys_size
from system.parts
where active
group by database, table
order by bytes_size desc;

Дізнаємось скільки в Clickhouse зайняли логи.

Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

Розмір таблиці logs займає 857.19 МБ.

Надсилання Nginx json логів за допомогою Vector в Clickhouse і Elasticsearch

Розмір тих же даних в індексі в Elasticsearch займає 4,5 ГБ.

Якщо в векторі параметри не вказувати в Clickhouse дані займає в 4500/857.19 = 5.24 рази менше, ніж в Elasticsearch.

У векторному полі compression використовується за замовчуванням.

Телеграм-чат по Clickhouse
Телеграм-чат по Elasticsearch
Телеграм-чат по "Збір та аналітика системних повідомлень"

Джерело: habr.com

Додати коментар або відгук