背景:

有时候,安装的Ubuntu系统,会有不满意一开始创建的用户名,但是又因为在该用户下装了一些东西,不希望重新创建新用户进行使用,想要直接修改用户名的需求。

这里提供一个案例:

dev 用户名修改为 test 用户

- 阅读剩余部分 -

通过ssh连接服务器失败

$ ssh root@172.16.0.247
Unable to negotiate with 172.16.0.247 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

SSH 客户端和远程服务器无法协商使用相同的 host key 类型。

解决方法:

添加参数

# -oHostKeyAlgorithms=+ssh-rsa           允许接收远程主机提供的 ssh-rsa 类型的 主机密钥(连接握手阶段)
# -oPubkeyAcceptedAlgorithms=+ssh-rsa    允许使用 ssh-rsa 类型的 用户身份验证公钥(登录认证阶段)
ssh root@172.16.0.247 -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa

- 阅读剩余部分 -

变量值来源是否显示端口说明
$host按照 请求行中的Host > 请求头中的Host > server_name 的值 优先级获取"Host:port"显示值为a:b的时候,只显示a
$http_host请求头中的Host"Host:port",port存在就显示,请求头中Host是多少 $http_host就是多少
$proxy_hostproxy_pass 指定的地址是(默认80不显示)"Host:port" proxy_pass指定的 "Host:port",当port为80的时候只有“Host”,其它端口,正常显示为 “Host:port”

- 阅读剩余部分 -

架构:

Grafana + Prometheus + 第三方Exporter

  • Grafana:查询数据,通过面板展示监控项,统一展示。
  • Prometheus:配置不同的job,获取多方面监控指标数据,供Grafana查询获取展示。
  • 第三方Exporter:获取相关数据,供Prometheus获取存储。比如: node_exporterblackbox_exporterredis_exporterpostgres_exporternginx-module-vts

- 阅读剩余部分 -

Promtail报错

level=warn ts=2025-05-07T06:44:22.715765487Z caller=client.go:369 component=client host=local-loki:3100 msg="error sending batch, will retry" status=500 error="server returned HTTP status 500 Internal Server Error (500): rpc error: code = DeadlineExceeded desc = context deadline exceeded"

查看loki 日志

level=info ts=2025-05-07T06:44:11.830518711Z caller=checkpoint.go:615 msg="starting checkpoint"
level=info ts=2025-05-07T06:44:11.830788697Z caller=checkpoint.go:340 msg="attempting checkpoint for" dir=/data/wal/checkpoint.1237659
level=warn ts=2025-05-07T06:44:20.643216928Z caller=logging.go:86 traceID=1f665e71538b4138 orgID=fake msg="POST /loki/api/v1/push (500) 5.012615543s Response: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\\n\" ws: false; Connection: close; Content-Length: 266310; Content-Type: application/x-protobuf; User-Agent: promtail/2.6.1; "
level=warn ts=2025-05-07T06:44:21.530545119Z caller=logging.go:86 traceID=1e71d2fb0b8fa807 orgID=fake msg="POST /loki/api/v1/push (500) 5.289903404s Response: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\\n\" ws: false; Connection: close; Content-Length: 217308; Content-Type: application/x-protobuf; User-Agent: promtail/2.6.1; "
level=warn ts=2025-05-07T06:44:22.441075158Z caller=logging.go:86 traceID=646a00c6b84f9eff orgID=fake msg="POST /loki/api/v1/push (500) 5.100367208s Response: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\\n\" ws: false; Connection: close; Content-Length: 265673; Content-Type: application/x-protobuf; User-Agent: promtail/2.6.1; "
level=warn ts=2025-05-07T06:44:22.448904508Z caller=logging.go:86 traceID=7c39e6b8a70cd408 orgID=fake msg="POST /loki/api/v1/push (500) 5.31823812s Response: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\\n\" ws: false; Connection: close; Content-Length: 267119; Content-Type: application/x-protobuf; User-Agent: promtail/2.6.1; "
level=info ts=2025-05-07T06:45:04.018620273Z caller=table_manager.go:134 msg="uploading tables"
level=info ts=2025-05-07T06:45:04.018708423Z caller=index_set.go:86 msg="uploading table index_20215"

context deadline exceeded 超出上下文截至时间

这几个报错的时间都在5s,应该是有配置限制

处理方法

参考:https://github.com/grafana/loki/issues/6182#issuecomment-1695993787

# Ingester_client块配置了分配器distributor将如何连接到摄入器ingesters。仅在运行所有组件,分销商distributor或查询querier时都适当。
ingester_client:
  remote_timeout: 10s # 客户端的远程请求超时时间

默认配置

# The remote request timeout on the client side.
# 客户端的远程请求超时。
# CLI flag: -ingester.client.timeout
[remote_timeout: <duration> | default = 5s]