# 常见问题

## Socket error occurred: `localhost/0:0:0:0:0:0:0:1:2181`: Connection refused

检查本地zookeeper有没启动，如果zookeeper在其他机器上，修改application-dev.yml

```yaml
cloud:
    zookeeper:
      connect-string: ip:2181
```

## 如何关闭签名验证

- 针对某一个接口关闭签名验证
`@ApiMapping(value = "alipay.story.get", ignoreValidate = true)`

- 针对所有接口关闭签名验证

```java
@Configuration
public class ZuulConfig extends AlipayZuulConfiguration {

    static {
        ...
        ApiConfig.getInstance().setIgnoreValidate(true);
        ...
    }

}
```

## 注册到eureka显示hostname，非ip

```yaml
eureka:
  instance:
    prefer-ip-address: true
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
```

```xml
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-commons</artifactId>
</dependency>
```

参考：https://www.jianshu.com/p/5ad8317961b7
