linkpwd's blog 自留地
ELK日志系统配置优化

ELK日志系统配置优化,ELK系统配置还算是挺多的,各个input output之间输入输出的,初学者可能会对其中一些配置不知如何下手。如不使用logstash如何配置等,如使用input redis , output elastic等

ELK日志系统性能优化

一、问题:

ELK日志系统延时严重,redis经常是内存使用率100%

WebSocket服务部署

配置文件,使支持websocket协议

websocket-nginx

k8s环境中loki安装部署

ELK这套日志系统相对来说还是太重了,安装部署过程也不简单,消耗的CPU、内存资源也较大。而loki则轻量级,且是根据prometheus思想开发的,消耗资源也很小。以下用它来采集下日志。

公网IP地址查询方法

查公网ip的一些链接,以前有一些,当然自己也可以使用nginx return,主要内容来自aliyun文档,记录收藏一下

elasticsearch单机docker版

拉取镜像,设置目录和环境变量并运行

1
2
3
4
5
6
docker run -p 29200:9200 -p 29300:9300 --name elasticsearch --restart=always \
-e "discovery.type=single-node" \
-e "cluster.name=elasticsearch" \
-v /mnt/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-v /mnt/elasticsearch/data:/usr/share/elasticsearch/data \
-d elastic/elasticsearch:7.10.2

需要在配置文件中开启x-pack验证, 修改config目录下面的elasticsearch.yml文件,在里面添加如下内容,并重启.

1
2
3
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true

执行设置用户名和密码的命令,这里需要为4个用户分别设置密码,elastic, kibana, logstash_system,beats_system

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
bin/elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana_system]:
Reenter password for [kibana_system]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

修改密码的方式:

1
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "mypassword" }'
frp内网穿透

下载frp release的版本,server端linux, client端windows

frp

kibana Stack Monitoring deny

今天点击Stack Monitoring查看ES集群日志性能的时候,发现出错了,于是有此文

docker的一些总结

操作系统基础镜像

名称 大小 包管理 场景
busybox 1.xMB apk, lbu 超级简化版嵌入式
alpine 5.x MB apk, lbu Alpine是一个面向安全的、轻量级的Linux系统,基于musl libc和busybox
ubuntu 70~80 MB apt-get, dpkg 非常出色的Linux发行版
debian 120~+/- MB apt-get, dpkg 非常出色的Linux发行版,很多基于它的发行版
centos 200+ MB yum, rpm CentOS是RedHat的社区版

编程语言基础镜像

名称 tag 说明
java openjdk:11 由于oracle jdk版本,不提供docker官方,可手动下载打docker镜像
python 3.9.7-alpine3.14
go 1.16.8-alpine3.14
nodejs 14-alpine3.12/16-alpine3.12

个人常用工具及应用

名称 tag 说明
maven 3.8.2-jdk-8-slim/3.8.2-openjdk-17
jenkins 2.60.3
GitLab gitlab/gitlab-ce
yearning 2.3.5
mysql 8.0.26
nginx stable-alpine, 1.20-alpine

alpine的工小具

名称 用途 说明
alpine/k8s CI/CD相关的时候 Kubernetes toolbox for EKS (kubectl, helm, iam-authenticator, eksctl, etc)
alpine/git 临时的git command A simple git container running in alpine linux, especially for tiny linux distro.
alpine/helm heam相关 Auto-trigger docker build for kubernetes helm when new release is announced
alpine/jmeter 压测
alpine/dfimage 解析镜像中的内容,便于重新反写Dockerfile文件 reverse Docker images into Dockerfiles
alpine/ansible 运维管理工作

运行一些常用docker的命令

mysql server :

gitlab通过pipeline实现ci/cd

运行环境 gitlab + gitlab runner运行环境

gitlab分gitlab/gitlab-ce, gitlab/gitlab-ee, 社区版本和企业版本
系统: CentOS7.9
docker: 20.10.8
gitlab版本: GitLab Community Edition 14.1.2