linux配置http/s代理时密码中遇到特殊字符处理

以配置system管理的exporter为例,密码中含有#导致启动失败报错,决办法 就是将特殊字符转换成 ASIIC 码形式输入, 以 % + Hex 形式

[Unit]
Description=ES1 Exporter
After=network.target

[Service]
User=nobody
Group=nobody
Type=simple
ExecStart=/data/elasticsearch_exporter/elasticsearch_exporter --es.all --es.indices --es.cluster_settings --es.indices_settings --es.shards --es.slm --es.data_stream --es.timeout=10s --web.listen-address=:9114 --es.uri http://monitor_exporter:xxx%235xxxx@10.x.x.x:9200

[Install]
WantedBy=multi-user.target

另外一种设置环境变量

export http_proxy_es1=http://monitor_exporter:xxx%235xxxx@10.x.x.x:9200

常见的ASIIC码如下,ASIIC官方连接:https://www.w3schools.com/charsets/ref_html_ascii.asp

~ : 0x7E,         ! : 0x21    
@ : 0x40,         # : 0x23  
$ : 0x24,         % : 0x25  
^ : 0x5E,         & : 0x26  
* : 0x2A,         ? : 0x3F 

此条目发表在ELK日志服务器分类目录。将固定链接加入收藏夹。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注