Skip to content

Development Solution Overview

9.1 Front-End Development Solution

9.2 Distributed Configuration Center Solution

1) Why etcd?

etcd is a distributed, reliable key-value store for critical data in distributed systems. It can provide service registration and discovery as well as centralized configuration management. Because it is written in Go, it integrates well with the Ubases IoT backend technology stack.

2) What Is etcd?

etcd is a consistent distributed key-value store. It provides a reliable way to store data across a distributed system or cluster and handles leader election gracefully, even during network partitions or machine failures.

As projects such as CoreOS and Kubernetes gained traction in the open-source community, etcd—used as a highly available, strongly consistent service discovery store—drew increasing attention from developers.

Main characteristics:

  • Simple: An HTTP+JSON API that you can use easily with curl.
  • Secure: Optional SSL client authentication.
  • Fast: Each instance supports about one thousand write operations per second.
  • Reliable: Fully distributed using the Raft algorithm.
  • Data: Persistent by default—etcd persists data on every update.

3) etcd Use Cases

Scenario 1: Service Discovery

Service discovery addresses a common challenge in distributed systems: enabling processes or services in the same cluster to locate one another by name and establish connections. A service first registers its name and IP address or domain name with the etcd configuration center. A client then retrieves the list of addresses mapped to that service name, uses a client-side load-balancing algorithm such as random selection or round robin to select one address, and connects to it.

微服务调用流程1

Scenario 2: Configuration Center

Production applications typically run in clusters. When a configuration changes in etcd, the application cluster can receive the update promptly, allowing a single change to update multiple services and reducing deployment overhead. During deployment, service configuration files are written to the etcd configuration center automatically or manually. These files are divided into shared configuration and service-specific configuration. At startup, each service retrieves and merges both sets before starting. Administrators can update configuration through the etcdkeeper UI, after which etcd pushes the changes to the microservices in real time. Changes to settings such as ports require the services to be restarted in batches, for example with kubectl, so that they retrieve the latest configuration.

4) etcd Configuration Management Flow

Users change etcd cluster configuration files via the etcdkeeper UI. On service startup, related configuration documents are pulled from the etcd cluster for service initialization.

Etcd配置中心架构图

9.3 MCU SDK Development Solution

The MCU SDK is generated automatically from the product functions defined on the Ubases IoT open platform. When a user clicks Download, the platform loads the MCU SDK template, retrieves the product data-point definitions from the database or cache, renders the template, and streams MCU_SDK.zip to the client. The generated SDK includes communication and protocol-parsing frameworks and can be added directly to an existing project to accelerate MCU development.

MCU_SDK下载流程(1)

9.4 Ubases IoT Error Code Solution

1) Ubases IoT Error Code Handling Flow

错误码处理流程图

2) Error Code Format

Error codes use a unified 6-digit numeric format as follows:

统一格式: A-BB-CCC
A: 表示错误类别,如1代表系统级错误,2代表输入参数错误,3代表业务级错误,4代表内部服务错误
B: 表示微服务项目名称,一般微服务项目数量不会超过99个,已经够用,范围01-99
C: 表示具体错误编号,自增即可,范围001-999

Segment B is allocated by business domain, with reserved ranges for future needs. Service assignments for segment B are as follows:

Segment BCorresponding service
01iot-user-service
02iot-auth-service
03iot-mqtt-service
04iot-mqtt-data-service
05iot-sys-notifier-service
06-20Reserved
21iot-cloud-api-service
22iot-product-service
23iot-device-service
24iot-intelligence-service
25iot-device-simulator
26iot-system-service
27iot-open-system-service
28iot-basic-service
29iot-log-service
30iot-statitstics-service
31iot-oss-service
32iot-language-service
33iot-document-service
34-50Reserved
51iot-app-api-service
52iot-app-build-service
53iot-app-message-service
54iot-app-notifier-service
55iot-app-oem-service
56iot-job-service
57iot-device-job-service
58iot-ip-service
59iot-weather-service
60-99Reserved

3) Error Code Categories

a) System-level errors

For system-level errors, segment A is 1, segment B may be 00, and segment C increments. For example, 100001 means system error. Common system-level error codes (to be supplemented or replaced over time):

Error codeError messageDetailed description
100001system errorSystem error
100002service unavailableService unreachable
100003remote service errorRemote service error
100004rpc errorRPC error
100005illegal requestIllegal request
100006invalid userInvalid user
100007request body length over limitRequest length exceeds limit
100008request api not foundAPI does not exist
100009http method not supportHTTP method not supported
100010ip requests  over limitIP request rate exceeds limit
100011user requests over limitUser request rate exceeds limit
100012api request over limitAPI request rate exceeds limit

b) Input parameter errors

For input parameter errors, segment A is 2, segment B is filled by service category, and segment C by the specific error. For example, 251001 means product key is empty in iot-app-api-service. Input parameter error codes (to be supplemented):

Error codeError messageError description
251001product key is emptyProduct key is empty
.........

c) Business-level errors

For business-level errors, segment A is 3, segment B is filled by service category, and segment C by the specific error. For example, 351001 means phone number is empty in iot-app-api-service. Business-level error codes (to be supplemented):

Error codeError messageError description
355001flash screen create errorSplash screen create error
.........

d) Internal service errors

For internal service errors, segment A is 4, segment B is filled by service category, and segment C by the specific error. For example, 402001 means auth service unavailable in iot-auth-service. Internal service error codes (to be supplemented):

Error codeError messageError description
402001auth service unavailableAuth service unreachable
.........

Note: The input parameter, business-level, and internal service error code tables above are only examples of how to define error codes; they do not imply that error codes must start in this order.

Released under the MIT License. Build Time 2026-09-11 14:52:23