Convert Figma logo to code with AI

alibaba logonacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.

29,954
12,785
29,954
262

Top Related Projects

External configuration (server and client) for Spring Cloud

28,222

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.

47,330

Distributed reliable key-value store for the most critical data of a distributed system

12,362

AWS Service registry for resilient mid-tier load balancing and failover.

12,136

Apache ZooKeeper

Quick Overview

Nacos is an open-source platform for cloud-native application management, including service discovery, configuration management, and dynamic scaling. It provides a unified interface for any runtime environment, allowing users to manage their entire application lifecycle easily.

Pros

  • Service Discovery: Nacos offers a reliable and scalable service discovery mechanism, enabling seamless communication between microservices.
  • Configuration Management: Nacos provides a centralized platform for managing application configurations, making it easy to maintain and update configurations across different environments.
  • Dynamic Scaling: Nacos supports dynamic scaling of applications, allowing for efficient resource utilization and high availability.
  • Extensibility: Nacos is designed to be highly extensible, with support for various cloud platforms and integration with popular frameworks like Spring Cloud, Kubernetes, and Istio.

Cons

  • Steep Learning Curve: Nacos has a relatively steep learning curve, especially for developers who are new to cloud-native architectures and service discovery mechanisms.
  • Limited Documentation: While the Nacos documentation is comprehensive, it may not be as user-friendly or well-organized as some developers would prefer.
  • Performance Concerns: In large-scale deployments, Nacos may experience performance issues, particularly with high-frequency service registration and discovery operations.
  • Vendor Lock-in: Nacos is primarily developed and maintained by Alibaba, which may raise concerns about vendor lock-in for some users.

Code Examples

Since Nacos is a platform for cloud-native application management, it does not provide a traditional code library. However, here are some examples of how Nacos can be used in a Spring Cloud-based application:

// Registering a service with Nacos
@SpringBootApplication
@EnableDiscoveryClient
public class MyServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyServiceApplication.class, args);
    }
}
// Consuming a service from Nacos
@RestController
public class MyController {
    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("/hello")
    public String hello() {
        List<ServiceInstance> instances = discoveryClient.getInstances("my-service");
        ServiceInstance instance = instances.get(0);
        return "Hello from " + instance.getHost() + ":" + instance.getPort();
    }
}
# Configuring Nacos in application.yml
spring:
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
      config:
        server-addr: 127.0.0.1:8848
        file-extension: yaml

Getting Started

To get started with Nacos, follow these steps:

  1. Install Nacos: Download the latest version of Nacos from the official website and extract the package.
  2. Start the Nacos server: Navigate to the extracted Nacos directory and run the following command to start the Nacos server:
    ./bin/startup.sh -m standalone
    
  3. Verify the Nacos server: Open a web browser and navigate to http://127.0.0.1:8848/nacos. You should see the Nacos console.
  4. Integrate Nacos with your application: Depending on the framework you're using (e.g., Spring Cloud, Kubernetes), follow the official documentation to integrate Nacos with your application.
  5. Register services: Use the Nacos console or the provided APIs to register your services with Nacos.
  6. Manage configurations: Use the Nacos console or the provided APIs to manage your application configurations.

For more detailed instructions and advanced usage, refer to the Nacos documentation.

Competitor Comparisons

External configuration (server and client) for Spring Cloud

Pros of Spring Cloud Config

  • Tight Integration with Spring Ecosystem: Spring Cloud Config is designed to work seamlessly with the Spring ecosystem, making it a natural choice for Spring-based applications.
  • Centralized Configuration Management: Spring Cloud Config provides a centralized approach to managing application configurations, making it easier to maintain and update configurations across multiple environments.
  • Flexible Configuration Sources: Spring Cloud Config supports a variety of configuration sources, including Git repositories, Vault, and custom implementations, providing flexibility in how configurations are stored and accessed.

Cons of Spring Cloud Config

  • Dependency on Spring: Spring Cloud Config is tightly coupled with the Spring framework, which may be a drawback for non-Spring-based applications.
  • Limited Scalability: Spring Cloud Config may not be as scalable as other configuration management solutions, especially for large-scale, distributed systems.
  • Complexity: Integrating Spring Cloud Config into a project can add complexity to the overall system, which may be a concern for smaller or less experienced teams.

Code Comparison

Spring Cloud Config

@Configuration
public class ConfigServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

Nacos

@SpringBootApplication
public class NacosApplication {
    public static void main(String[] args) {
        SpringApplication.run(NacosApplication.class, args);
    }
}

The main difference in the code is the use of the @Configuration annotation in the Spring Cloud Config example, which is used to configure the Spring Cloud Config server, while the Nacos example uses the @SpringBootApplication annotation, which is a convenience annotation that adds all of the above features and more.

28,222

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.

Pros of Consul

  • Consul provides a robust service discovery and health checking mechanism, allowing for easy integration with various cloud platforms and infrastructure.
  • Consul's support for multi-datacenter and multi-cloud deployments makes it a suitable choice for large-scale, distributed environments.
  • Consul's built-in support for service mesh and service-oriented architectures can simplify the management of complex microservices-based applications.

Cons of Consul

  • Consul's configuration management and key-value store features may be less comprehensive compared to Nacos, which is designed as a more complete configuration management and service discovery solution.
  • Consul's learning curve and complexity may be higher than Nacos, especially for teams with limited experience in service discovery and distributed systems.

Code Comparison

Nacos configuration management:

// Nacos configuration management
NacosConfigService configService = NacosFactory.createConfigService(properties);
String content = configService.getConfig("dataId", "group", 5000);

Consul service registration:

// Consul service registration
client, _ := api.NewClient(api.DefaultConfig())
registration := &api.AgentServiceRegistration{
    ID:      "web1",
    Name:    "web",
    Address: "192.168.10.10",
    Port:    8080,
}
client.Agent().ServiceRegister(registration)
47,330

Distributed reliable key-value store for the most critical data of a distributed system

Pros of etcd-io/etcd

  • Highly scalable and reliable distributed key-value store, suitable for critical infrastructure
  • Extensive documentation and active community support
  • Supports a wide range of programming languages and platforms

Cons of etcd-io/etcd

  • Relatively complex setup and configuration compared to Nacos
  • Steeper learning curve for developers unfamiliar with distributed systems
  • May have higher resource requirements (CPU, memory) for smaller-scale use cases

Code Comparison

etcd-io/etcd

// Get a value from etcd
resp, err := client.Get(context.Background(), "/my-key")
if err != nil {
    // handle error
}
fmt.Println(resp.Kvs[0].Value)

alibaba/nacos

// Get a value from Nacos
String value = nacosService.getConfig("my-key", "default", 5000);
System.out.println(value);

The etcd-io/etcd code snippet demonstrates a basic key-value retrieval operation, while the alibaba/nacos code snippet shows a similar operation using the Nacos service. The Nacos code appears more concise and easier to use, especially for developers unfamiliar with distributed systems.

12,362

AWS Service registry for resilient mid-tier load balancing and failover.

Pros of Eureka

  • Eureka is a mature and well-established service discovery solution, with a large and active community.
  • Eureka provides a simple and intuitive API for service registration and discovery.
  • Eureka has a robust and reliable architecture, with features like load balancing and failover.

Cons of Eureka

  • Eureka is primarily focused on service discovery, and may lack some of the advanced features found in Nacos, such as configuration management and service health monitoring.
  • Eureka may have a steeper learning curve compared to Nacos, especially for developers who are new to the Spring ecosystem.

Code Comparison

Eureka Server Startup:

@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }
}

Nacos Server Startup:

@SpringBootApplication
@EnableNacosDiscovery
public class NacosServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(NacosServerApplication.class, args);
    }
}
12,136

Apache ZooKeeper

Pros of Zookeeper

  • Zookeeper is a mature and widely-used distributed coordination service, with a large and active community.
  • Zookeeper provides strong consistency guarantees, making it suitable for critical applications.
  • Zookeeper has a rich set of features, including leader election, distributed locking, and configuration management.

Cons of Zookeeper

  • Zookeeper can be complex to set up and maintain, especially in large-scale deployments.
  • Zookeeper has a relatively low write throughput compared to some newer coordination services.
  • Zookeeper's Java-based implementation may not be the best fit for all environments.

Code Comparison

Zookeeper:

public class ZooKeeperMain {
    public static void main(String[] args) throws Exception {
        ZooKeeper zk = new ZooKeeper("localhost:2181", 5000, new Watcher() {
            public void process(WatchedEvent event) {
                System.out.println("Event: " + event.getType());
            }
        });
        String path = zk.create("/znode", "data".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        System.out.println("Created " + path);
        zk.close();
    }
}

Nacos:

public class NacosExample {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        properties.put("serverAddr", "localhost:8848");
        NacosFactory.createConfigService(properties).publishConfig("dataId", "group", "Hello Nacos");
        String content = NacosFactory.createConfigService(properties).getConfig("dataId", "group", 5000);
        System.out.println(content);
    }
}

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Nacos: Dynamic Naming and Configuration Service

Gitter License Gitter


What does it do

Nacos (official site: nacos.io) is an easy-to-use platform designed for dynamic service discovery and configuration and service management. It helps you to build cloud native applications and microservices platform easily.

Service is a first-class citizen in Nacos. Nacos supports almost all type of services,for example,Dubbo/gRPC service, Spring Cloud RESTFul service or Kubernetes service.

Nacos provides four major functions.

  • Service Discovery and Service Health Check

    Nacos makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Nacos also provides real-time health checks of services to prevent sending requests to unhealthy hosts or service instances.

  • Dynamic Configuration Management

    Dynamic Configuration Service allows you to manage configurations of all services in a centralized and dynamic manner across all environments. Nacos eliminates the need to redeploy applications and services when configurations are updated, which makes configuration changes more efficient and agile.

  • Dynamic DNS Service

    Nacos supports weighted routing, making it easier for you to implement mid-tier load balancing, flexible routing policies, flow control, and simple DNS resolution services in the production environment within your data center. It helps you to implement DNS-based service discovery easily and prevent applications from coupling to vendor-specific service discovery APIs.

  • Service and MetaData Management

    Nacos provides an easy-to-use service dashboard to help you manage your services metadata, configuration, kubernetes DNS, service health and metrics statistics.

Quick Start

It is super easy to get started with your first project.

Deploying Nacos on cloud

You can deploy Nacos on cloud, which is the easiest and most convenient way to start Nacos.

Use the following Nacos deployment guide to see more information and deploy a stable and out-of-the-box Nacos server.

Start by the provided startup package

Step 1: Download the binary package

You can download the package from the latest stable release.

Take release nacos-server-1.0.0.zip for example:

unzip nacos-server-1.0.0.zip
cd nacos/bin 

Step 2: Start Server

On the Linux/Unix/Mac platform, run the following command to start server with standalone mode:

sh startup.sh -m standalone

On the Windows platform, run the following command to start server with standalone mode. Alternatively, you can also double-click the startup.cmd to run NacosServer.

startup.cmd -m standalone

For more details, see quick-start.

Quick start for other open-source projects:

Documentation

You can view the full documentation from the Nacos website.

You can also read this online eBook from the NACOS ARCHITECTURE & PRINCIPLES.

All the latest and long-term notice can also be found here from GitHub notice issue.

Contributing

Contributors are welcomed to join Nacos project. Please check CONTRIBUTING about how to contribute to this project.

How can I contribute?

  • Take a look at issues with tags marked good first issue or contribution welcome.
  • Answer questions on issues.
  • Fix bugs reported on issues, and send us a pull request.
  • Review the existing pull request.
  • Improve the website, typically we need
    • blog post
    • translation on documentation
    • use cases around the integration of Nacos in enterprise systems.

Other Related Project Repositories

  • nacos-spring-project provides the integration functionality for Spring.
  • nacos-group is the repository that hosts the eco tools for Nacos, such as SDK, synchronization tool, etc.
  • spring-cloud-alibaba provides the one-stop solution for application development over Alibaba middleware which includes Nacos.

Contact

  • Gitter: Nacos's IM tool for community messaging, collaboration and discovery.
  • Twitter: Follow along for latest nacos news on Twitter.
  • Weibo: Follow along for latest nacos news on Weibo (Twitter of China version).
  • Nacos Segmentfault: Get latest notice and prompt help from Segmentfault.
  • Email Group:
  • Join us from DingDing(Group 1: 21708933(full), Group 2: 30438813(full), Group 3: 31222241(full), Group 4: 12810027056).

Enterprise Service

If you need Nacos enterprise service support, or purchase cloud product services, you can join the discussion by scanning the following DingTalk group. It can also be directly activated and used through the microservice engine (MSE) provided by Alibaba Cloud. https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0

Download

Who is using

These are only part of the companies using Nacos, for reference only. If you are using Nacos, please add your company here to tell us your scenario to make Nacos better.

Alibaba Group 虎牙直播 ICBC 爱奇艺 平安科技 华夏信财 优客工场 贝壳找房 瑞安农村商业银行 司法大数据 搜易贷 平行云 甘肃紫光 海云天 Acmedcare+ 北京天合互联信息有限公司 上海密尔克卫化工 大连新唯 立思辰 东家 上海克垚 联采科技 南京28研究所 凤凰网-汽车 中化信息 一点车 明传无线 妙优车 蜂巢 华存数据 数云 广通软件 菜菜 科蓝公司 浩鲸 未名天日语 金联创 同窗链 顺能 百世快递 汽车之家 鲸打卡 时代光华 康美 环球易购 Nepxion chigua 宅无限 天阙 联合永道 明源云 DaoCloud 美菜 松格科技 集萃智能 吾享 拓深科技 长亮科技 深圳易停车库 武汉日创科技 易管智能 云帐房 三诺生物

郑州山水, 知氏教育

NPM DownloadsLast 30 Days