在学习elasticsearch curator,安装后,执行命令总是报错argument should be a bytes-like object or ASCII TypeError: argument should be a bytes-like object or ASCII string, not NoneType 查了一下,大概是api密钥配置错误,查了半天也没整明白怎么配置,我的config.yml配置如下
# Remember, leave a key empty if there is no value. None will be a string,
# not a Python "NoneType"
elasticsearch:
client:
hosts:
- http://11.1.111.111:9200
cloud_id:
ca_certs:
client_cert:
client_key:
verify_certs:
request_timeout: 30
other_settings:
master_only: False
username: es
password: 123456
api_key:
id:
api_key:
token:
logging:
loglevel: INFO
logfile:
logformat: default
blacklist: ['elastic_transport', 'urllib3']
请问该具体怎么配置呢?
我的elasticsearch版本是8.1.12版,curator是8.0版的
由于curator在运行时没有读取到正确的配置文件导致的。根据你提供的config.yml文件,其中并没有配置elasticsearch.api_key,但是curator默认会读取配置文件中的elasticsearch.api_key部分,因此你可以在config.yml中添加如下内容:
elasticsearch:
api_key:
id: "your_api_key_id"
api_key: "your_api_key"
如果没有在Elasticsearch中设置API密钥,则可以留空elasticsearch.api_key部分,例如:
elasticsearch:
api_key:
id:
api_key:
注意,elasticsearch.api_key部分必须在elasticsearch.client部分之后定义,例如:
elasticsearch:
client:
hosts:
- http://11.1.111.111:9200
username: es
password: 123456
request_timeout: 30
api_key:
id: "your_api_key_id"
api_key: "your_api_key"
另外,建议检查一下其他配置是否正确,并确保配置文件位于curator可以访问到的位置。