我正在嘗試在我的 gitlab 管道中運行 elasticsearch 7.0.1,這是配置片段:
test:
stage: test
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
alias: elastic
variables:
cluster.initial_master_nodes: elastic
node.name: elastic
但是當我運行它時,我收到以下錯誤訊息:
/bin/bash: line 82: export: `cluster.initial_master_nodes=elastic': not a valid identifier
似乎 Gitlab 使用 bash 匯出變數,但 bash 不允許名稱中包含點。我嘗試用雙下劃線轉義,但沒有用。有什么建議?
uj5u.com熱心網友回復:
帶點的變數名在 sh 和 bash 中確實無效。
該官方檔案有一個解決方案:
Change the setting name to uppercase
Prefix it with ES_SETTING_
Escape any underscores (_) by duplicating them
Convert all periods (.) to underscores (_)
試試變數名(注意雙下劃線):
ES_SETTING_CLUSTER_INITIAL__MASTER__NODES: elastic
ES_SETTING_NODE_NAME: elastic
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/377948.html
