NACOS upgrade

Server-side

0.8.0 and above:

  1. After extracting installation package replaces {nacos.home} /target/nacos-server.jar
  2. {Nacos.home} delete all files / plugins / cmdb / and {nacos.home} / plugins / health / in
  3. One by one to restart Nacos Server

The following version 0.8.0, first upgrade to version 1.0.0.

Client-side

Please use the latest version 1.1.1, fixes a client version 1.1.0 version of the display problems.

New Features

  • Gray Configuration
  • Import and export configuration and configuration synchronization
  • Address Server Module
  • Service subscriber list
  • Examples of custom heartbeat period
  • Config Listeners optimization
  • Nacos Go SDK released

 

Gray Configuration

@yanlinly  @loadchange

Grayscale configuration refers to the specified portion of the client IP were issued new configuration, the remaining client configuration remains the same, to verify the impact of the new configuration of the client, to ensure a smooth release configuration. Gradation production environment configuration is a more important feature is important to ensure the stability of the production environment. In 1.1.0, Nacos to support the IP configuration for the particle size gradation, the specific use of the following steps:

1, in the configuration list page, click on an "Edit Configuration" button configuration:

2, check the "Beta release", issued to fill in the text box to configure the IP, multiple IP separated by commas:

3, modify the configuration content, click the "Publish Beta" button to complete the configuration of the gray-release:

4, click "Publish Beta", "released Beta" button is grayed out, then you can select "Stop Beta" or "release." "Stop Beta" release represents Cancel to stop gray, gray publish the current configuration of IP List and configure content will be deleted, the page posted back to normal style. "Release" means gray configure all client entry into force, the previous configuration will also be covered, while the page back to the normal pattern of release:

 

Import and export configuration and configuration synchronization

@ KeRan213539

Another common configuration management requirements is the ability to configure a cluster to another cluster synchronization, or sync from one namespace to another namespace. KeRan213539 contributors from the community contribution to this very useful feature, the use of specific steps are as follows:

1, export query results. According to the query, the query out all the results of the current packaged as a file:

2、 导出选中的配置:

3、 导入配置,可以选择相同配置的处理策略。

当发现有相同的配置时,会有相应的提示:

同时如果导入的配置文件格式不符合要求,也会有相应的提示:

4、 配置同步,选取想要同步的配置,点击“克隆”,然后再选择要同步的目标命名空间,就可以将配置同步到对应的命名空间:

5、 导入导出文件格式说明。均为zip压缩包,压缩包内有多个目录,目录名为配置的 group,目录下有具体的文件,文件名为配置的 dataId ,每个文件的内容为配置具体的内容:

地址服务器模块

@pbting

1.1.0的安装包列表里多了一个nacos-address-server-1.1.0。这个安装包的作用是作为地址服务器模块,单独部署。关于地址服务器的介绍可以参考Nacos官网地址服务器文章,这里只做一个简单的说明。

一般中间件产品,客户端寻址服务端的方式都是在客户端配置服务端的地址列表,这样有一个缺点是当服务端的地址发生变动时,客户端无法实时的感知到,也无法动态调整访问的服务端集群。而在阿里巴巴的一种比较常见的客户端寻址服务端的方式是地址服务器。简单的说就是部署单独的地址服务器,地址服务器提供接口,获取相关中间件产品服务端集群的地址。由于地址服务器功能比较单一,因此稳定性比较容易保证。客户端只需要配置地址服务器的域名,通过地址服务器获取想要访问的中间件的集群地址,这样既保证能够感知中间件集群的动态变化,也能够为客户端配置更灵活的集群访问策略。

下面介绍地址服务器模块的使用。

  1. 部署地址服务器

    1. 将安装包列表里的 nacos-address-server.tar.gz 或者 nacos-address-server.zip 解压。
    2. 单机模式启动:执行 sh bin/startup.sh -m standalone -s nacos-address 以 standalone 的方式启动 address server。
    3. 集群模式启动:在 conf 目录下 将 cluster.conf.example 重名名为 cluster.conf,然后加入其它 server 的节点。加完后,执行 sh bin/startup.sh -s nacos-address 即可。
  2. 配置地址服务器域名:将部署好的地址服务器集群IP挂载到一个域名下,我们假设为address.nacos.com
  3. 在地址服务器上配置 Nacos 集群的地址列表:
# Add IP to nacos cluster:
curl -X POST '$ADDRESS_SERVER:8080/nacos/v1/as/nodes?ips=1.1.1.1:8848,2.2.2.2:8848,3.3.3.3:8848'

# Remove IP from nacos cluster: curl -X DELETE '$ADDRESS_SERVER:8080/nacos/v1/as/nodes?ips=1.1.1.1:8848,2.2.2.2:8848,3.3.3.3:8848'
  1. 客户端配置 endpoint 为该地址服务器集群域名:在构造 Nacos 客户端时,除了可以通过指定 serverAddr 来访问 Nacos 集群外,还可以配置 endpoint 属性,将这个属性的值设为 address.nacos.com ,这样就可以达到和配置 serverAddr 相同的效果。
  2. 通过源码构建地址服务器安装包,在 Nacos 工程根目录下执行:
mvn -Prelease-address clean install -Dmaven.test.skip=true

安装包会生成在distribution/target目录下。

 

服务订阅者列表

@nicholas2015

服务订阅者列表是1.1.0增加的另外一个功能,就是可以在控制台上查看一个服务的消费者,执行步骤如下:

  1. 在服务列表页面,找到想要查询订阅者的服务:

  1. 进入订阅者列表页面,在“服务名称”输入框输入想要查询的服务名,在“分组名称”输入框输入服务的分组名(默认为DEFAULAT_GROUP),点击“查询”后,得到订阅者的信息,包括IP和端口、客户端版本和应用名。

服务自定义心跳周期

@lanCao

之前的版本中,客户端注册服务时,不能自定义上报心跳的周期以及客户端下线时自动删除实例的间隔。在1.1.0中,我们支持了这个特性,应用可以在注册时,通过设置实例的metadata,来指定心跳周期、健康检查过期时间及删除实例时间。具体举例如下:

String serviceName = randomDomainName();

Instance instance = new Instance();
instance.setIp("1.1.1.1");
instance.setPort(9999);
Map<String, String> metadata = new HashMap<String, String>(); // 设置心跳的周期,单位为秒,这里将心跳间隔设置为3秒: metadata.put(PreservedMetadataKeys.HEART_BEAT_INTERVAL, "3"); // 设置心跳超时时间,单位为秒,这里将心跳超时时间设为6秒, // 即服务端6秒收不到客户端心跳,会将该客户端注册的实例设为不健康: metadata.put(PreservedMetadataKeys.HEART_BEAT_TIMEOUT, "6"); // 设置实例删除的超时时间,单位为秒,这里将实例删除超时时间设为9秒, // 即服务端9秒收不到客户端心跳,会将该客户端注册的实例删除: metadata.put(PreservedMetadataKeys.IP_DELETE_TIMEOUT, "9"); instance.setMetadata(metadata); naming.registerInstance(serviceName, instance);

 

Config 监听器的优化

@chuntaojun
当存在程序启动之初,如果用户通过ConfigService.getConfig获取配置的同时,又注册了监听器,那么会存在监听器再次通知用户刚刚获取的配置信息。因此在version 1.1.0版本中,增加了新的接口以及一个系统参数(使用户无需修改现有代码)

String getConfigAndSignListener(String dataId, String group, long timeoutMs, Listener listener) throws NacosException;

该方法在获取配置后,随即注册一个监听器,避免监听器通知用户刚刚才拉取的配置信息
nacos.enableRemoteSyncConfig=true | false
设置该系统参数,将在监听器注册时主动去向远端拉取当前最新的配置信息,但是存在一定的网络开销,因此建议用户采取接口的方式

                      转自----------https://my.oschina.net/u/1464083/blog/3074303

 

Guess you like

Origin www.cnblogs.com/lhlucky/p/11671129.html