Polembedwa m'chinenero cha Rust, imadziwika ndi machitidwe apamwamba komanso kuchepa kwa RAM poyerekeza ndi zofanana zake. Kuphatikiza apo, chidwi chachikulu chimaperekedwa ku ntchito zokhudzana ndi kulondola, makamaka, kuthekera kosunga zochitika zosatumizidwa ku buffer pa disk ndikusintha mafayilo.
Zomangamanga, Vector ndi rauta yamwambo yomwe imalandira mauthenga kuchokera kwa amodzi kapena angapo magwero, ngati mukufuna kugwiritsa ntchito mauthengawa kusintha, ndi kuwatumiza kwa mmodzi kapena angapo ngalande.
Vector ndi m'malo mwa filebeat ndi logstash, imatha kugwira ntchito zonse ziwiri (kulandira ndi kutumiza zipika), zambiri pa iwo. malo.
Langizo ili ndi malangizo osinthidwa kuchokera Vyacheslav Rakhinsky. Malangizo apachiyambi ali ndi geoip processing. Poyesa geoip kuchokera pa netiweki yamkati, vekitala idapereka cholakwika.
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
Tikonza kuphatikiza kwa Nginx (Kufikira zipika) → Vector (Client | Filebeat) → Vector (Server | Logstash) → padera mu Clickhouse komanso padera mu Elasticsearch. Tikhazikitsa ma seva 4. Ngakhale mutha kuzilambalala ndi ma seva atatu.
Chiwembu ndi chinthu chonga ichi.
Letsani Selinux pa maseva anu onse
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
reboot
Timayika HTTP seva emulator + zofunikira pa maseva onse
Choyamba, tiyenera kukonza chipika mu Nginx mu fayilo /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;
}
Ndipo konzekerani kusintha kwa Filebeat mu /etc/vector/vector.toml config. IP adilesi 172.26.10.108 ndi adilesi ya IP ya seva ya chipika (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"
Musaiwale kuwonjezera wogwiritsa ntchito vekitala ku gulu lofunikira kuti athe kuwerenga mafayilo a log. Mwachitsanzo, nginx mu centos imapanga zipika zokhala ndi ufulu wamagulu adm.
usermod -a -G adm vector
Tiyeni tiyambe ntchito vekitala
systemctl enable vector
systemctl start vector
Zolemba za Vector zitha kuwonedwa motere:
journalctl -f -u vector
Payenera kukhala cholowa chonga ichi m'zipika
INFO vector::topology::builder: Healthcheck: Passed.
Kuyesa Kupanikizika
Timayesa pogwiritsa ntchito benchmark ya Apache.
Phukusi la zida za httpd linayikidwa pa ma seva onse
Timayamba kuyesa pogwiritsa ntchito benchmark ya Apache kuchokera ku maseva 4 osiyanasiyana pazenera. Choyamba, timatsegula chojambulira chowonjezera pazenera, kenako timayamba kuyesa pogwiritsa ntchito benchmark ya Apache. Momwe mungagwiritsire ntchito ndi skrini yomwe mungapeze nkhani.
Kuchokera pa seva yoyamba
while true; do ab -H "User-Agent: 1server" -c 100 -n 10 -t 10 http://vhost1/; sleep 1; done
Kuchokera pa seva yoyamba
while true; do ab -H "User-Agent: 2server" -c 100 -n 10 -t 10 http://vhost2/; sleep 1; done
Kuchokera pa seva yoyamba
while true; do ab -H "User-Agent: 3server" -c 100 -n 10 -t 10 http://vhost3/; sleep 1; done
Kuchokera pa seva yoyamba
while true; do ab -H "User-Agent: 4server" -c 100 -n 10 -t 10 http://vhost4/; sleep 1; done
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;
Tiyeni tiwone kuchuluka kwa zipika zomwe zidatenga ku Clickhouse.
Kukula kwa tebulo la zipika ndi 857.19 MB.
Kukula kwa data yomweyi mu index mu Elasticsearch ndi 4,5GB.
Ngati simunatchule zambiri mu vector mu magawo, Clickhouse imatenga 4500/857.19 = 5.24 kuchepera kuposa mu Elasticsearch.
Mu vector, gawo la compression limagwiritsidwa ntchito mwachisawawa.