我想创建一个带有保管库后端的配置服务器,并按照以下步骤操作:
storage "raft" {
path = "./vault/data"
node_id = "node1"
}
listener "tcp" {
address = "127.0.0.1:8200"
tls_disable = "true"
}
api_addr = "http://127.0.0.1:8200"
cluster_addr = "https://127.0.0.1:8201"
ui = true
Key Value
--- -----
Seal Type shamir
Initialized true
Sealed false
Total Shares 5
Threshold 3
Version 1.14.1
Build Date 2023-07-21T10:15:14Z
Storage Type raft
Cluster Name vault-cluster-d9454c69
Cluster ID 36c8d03f-522d-d9e9-4ae4-cceea7074298
HA Enabled true
HA Cluster https://127.0.0.1:8201
HA Mode active
Active Since 2023-08-08T09:12:40.45953Z
Raft Committed Index 40
Raft Applied Index 40
Vault 之前已通过 cli 命令解封。
server:
port: 8888
spring:
application:
name: config-server
cloud:
config:
server:
vault:
host: localhost
port: 8200
scheme: https
backend: kv
token: <<added token from vault operator init command>>
@SpringBootApplication
@EnableConfigServer
public class CloudConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(CloudConfigServerApplication.class, args);
}
}
当我尝试运行这个时:
***************************
APPLICATION FAILED TO START
***************************
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration. If you have set spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
尝试了不同的事情和资源,但找不到这个问题的解决方案。谁能帮忙看看是什么问题?
更新
我将方案更改为http并运行服务器
server:
port: 8888
spring:
application:
name: config-server
cloud:
config:
server:
vault:
host: localhost
port: 8200
scheme: http
backend: kv
token: <<added token from vault operator init command>>
仍然显示相同的错误。在尝试连接之前感觉 spring 失败了
造成这种情况的原因可能是因为您在配置中使用了
scheme: https
,但您使用http在端口8200上公开了连接,请尝试在spring配置中使用更改方案。