The Salt Master has cached the public key

故障现象:

某台服务器,重新安装salt-minion客户端后,发现salt-master与其通信出现问题,然后查询了服务的状态,发现有如下报错信息:

[root@LVS-RS01 ~]# systemctl status salt-minion -l
● salt-minion.service - The Salt Minion
   Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-01-14 20:48:40 CST; 1min 54s ago
     Docs: man:salt-minion(1)
           file:///usr/share/doc/salt/html/contents.html
           https://docs.saltstack.com/en/latest/contents.html
 Main PID: 43416 (salt-minion)
   CGroup: /system.slice/salt-minion.service
           ├─43416 /usr/bin/python /usr/bin/salt-minion
           ├─43425 /usr/bin/python /usr/bin/salt-minion
           └─43431 /usr/bin/python /usr/bin/salt-minion

Jan 14 20:48:39 LVS-RS01.saltstack.com systemd[1]: Starting The Salt Minion...
Jan 14 20:48:40 LVS-RS01.saltstack.com systemd[1]: Started The Salt Minion.
Jan 14 20:49:23 LVS-RS01.saltstack.com salt-minion[43416]: [ERROR   ] Error while bringing up minion for multi-master. Is master at 10.10.10.111 responding?
Jan 14 20:49:38 LVS-RS01.saltstack.com salt-minion[43416]: [ERROR   ] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate
Jan 14 20:49:48 LVS-RS01.saltstack.com salt-minion[43416]: [ERROR   ] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate
Jan 14 20:49:58 LVS-RS01.saltstack.com salt-minion[43416]: [ERROR   ] The Salt Master has cached the public key for this node, this salt minion will wait for 10 seconds before attempting to re-authenticate

处理过程:

[root@LVS-RS01 minion]# >/etc/salt/minion_id 
[root@LVS-RS01 minion]# systemctl restart salt-minion
[root@LVS-RS01 minion]# systemctl status salt-minion
● salt-minion.service - The Salt Minion
   Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-01-14 20:52:25 CST; 8s ago
     Docs: man:salt-minion(1)
           file:///usr/share/doc/salt/html/contents.html
           https://docs.saltstack.com/en/latest/contents.html
 Main PID: 45086 (salt-minion)
   CGroup: /system.slice/salt-minion.service
           ├─45086 /usr/bin/python /usr/bin/salt-minion
           ├─45095 /usr/bin/python /usr/bin/salt-minion
           └─45101 /usr/bin/python /usr/bin/salt-minion

Jan 14 20:52:25 LVS-RS01.saltstack.com systemd[1]: Starting The Salt Minion...
Jan 14 20:52:25 LVS-RS01.saltstack.com systemd[1]: Started The Salt Minion.
如果salt-key -L看到服务的key在Unaccepted Keys中,则删除这个key
[root@LVS-RS01 minion]# systemctl status salt-minion
● salt-minion.service - The Salt Minion
   Loaded: loaded (/usr/lib/systemd/system/salt-minion.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2018-01-14 20:52:25 CST; 17s ago
     Docs: man:salt-minion(1)
           file:///usr/share/doc/salt/html/contents.html
           https://docs.saltstack.com/en/latest/contents.html
 Main PID: 45086 (salt-minion)
   CGroup: /system.slice/salt-minion.service
           ├─45086 /usr/bin/python /usr/bin/salt-minion
           ├─45095 /usr/bin/python /usr/bin/salt-minion
           └─45101 /usr/bin/python /usr/bin/salt-minion

Jan 14 20:52:25 LVS-RS01.saltstack.com systemd[1]: Starting The Salt Minion...
Jan 14 20:52:25 LVS-RS01.saltstack.com systemd[1]: Started The Salt Minion.
[root@LVS-RS01 minion]# salt '*' test.ping
LVS-RS01.saltstack.com:
    True

到此,问题得到解决。










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/2060851,如需转载请自行联系原作者
### 关于 @Cacheable 注解中的 Key 配置 在 Spring Cache 中,`@Cacheable` 是用于声明某个方法的结果可以被缓存的注解。通过 `key` 属性,开发者能够定义如何生成缓存键值来存储或检索缓存数据。 #### 1. **Key 的基本概念** 默认情况下,Spring 使用方法参数作为缓存键。如果未指定 `key` 属性,则会基于方法参数自动生成一个键。然而,在实际开发中,可能需要更复杂的逻辑来自定义缓存键。此时可以通过设置 `key` 属性实现这一需求[^1]。 #### 2. **Key 的配置方式** `key` 属性支持 SpEL(Spring Expression Language),允许使用表达式动态计算缓存键。SpEL 表达式的灵活性使得可以根据方法参数或其他上下文信息灵活构建缓存键。 以下是常见的几种 `key` 配置场景: - **简单字段匹配**: 如果只需要根据单个参数生成键,可以直接写入该参数名。 ```java @Cacheable(value = "users", key = "#id") public User findUserById(Long id) { return userRepository.findById(id); } ``` - **组合多个字段**: 当需要依据多个参数生成复合键时,可以用逗号分隔并结合运算符。 ```java @Cacheable(value = "orders", key = "#userId.concat('-').concat(#orderId)") public Order getOrderDetails(String userId, String orderId) { return orderRepository.findOrder(userId, orderId); } ``` - **访问对象属性**: 对象类型的参数也可以通过 `.property` 访问内部成员变量。 ```java @Cacheable(value = "products", key = "#productRequest.id") public Product getProduct(ProductRequest productRequest) { return productService.getProduct(productRequest.getId()); } ``` - **静态常量引用**: 可以引入外部定义好的静态常量到表达式里。 ```java @Cacheable(value = "settings", key = "'config-' + T(com.example.ConfigKeys).DATABASE_SETTING") public String getDatabaseSetting() { return configService.getDatabaseConfig(); } ``` 注意:为了使上述功能正常工作,还需要确保已经正确设置了缓存管理器以及相应的缓存提供者(如 Ehcache 或 Redis)。这通常是在应用启动阶段完成的工作[^2]。 #### 3. **完整的配置实例** 下面展示了一个包含 `AppConfig` 类及其关联组件扫描路径在内的完整例子,说明了如何启用缓存机制并与之配合使用 `@Cacheable` 注解。 ```java @Configuration @ComponentScan("com.wsh.autowired") // 扫描包下的所有 Bean 定义 @EnableCaching // 开启缓存支持 public class AppConfig { } @Service public class UserService { @Cacheable(value = "users", key = "#username") public User findByUsername(String username) { System.out.println("Fetching user from database..."); return new User(username); // 假设这里是从数据库获取用户信息 } } ``` 以上代码片段展示了如何在一个服务层的方法上标注 `@Cacheable` 并为其指定了特定的缓存名称 (`value`) 和键生成规则 (`key`)。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值