← 返回命令列表

Linux command

etcd 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start etcd server

etcd

Start with custom data directory

etcd --data-dir [/var/lib/etcd]

Start with specific listen address

etcd --listen-client-urls [http://localhost:2379]

Start with advertised URLs

etcd --advertise-client-urls [http://localhost:2379]

Start a cluster member

etcd --name [node1] --initial-cluster [node1=http://host1:2380,node2=http://host2:2380]

Enable TLS

etcd --cert-file [cert.pem] --key-file [key.pem]

说明

etcd is a distributed key-value store that provides reliable, consistent data storage for distributed systems. It implements the Raft consensus algorithm to ensure strong consistency across multiple nodes, making it suitable for critical configuration data and service coordination. The server forms the backbone of Kubernetes cluster state management and is used extensively in cloud-native architectures for configuration management, service discovery, and distributed locking. Its simple HTTP/gRPC API and watch functionality enable applications to respond to configuration changes in real-time. etcd prioritizes consistency and availability, making it ideal for storing cluster membership, feature flags, and other distributed system metadata.

参数

--name _name_
Human-readable node name.
--data-dir _path_
Data directory path.
--listen-client-urls _urls_
Client listen URLs.
--advertise-client-urls _urls_
Advertised client URLs.
--listen-peer-urls _urls_
Peer listen URLs.
--initial-cluster _config_
Initial cluster configuration.
--initial-cluster-state _state_
Initial cluster state (new or existing).
--cert-file _file_
TLS certificate file.
--key-file _file_
TLS key file.
--initial-cluster-token _token_
Unique cluster token to prevent cross-cluster interaction.
--initial-advertise-peer-urls _urls_
Peer URLs to advertise to the rest of the cluster.
--snapshot-count _count_
Number of committed transactions to trigger a snapshot to disk (default 100000).
--quota-backend-bytes _bytes_
Raise alarms when backend size exceeds the given quota (0 defaults to low space quota).
--max-request-bytes _bytes_
Maximum client request size in bytes the server will accept (default 1572864).

FAQ

What is the etcd command used for?

etcd is a distributed key-value store that provides reliable, consistent data storage for distributed systems. It implements the Raft consensus algorithm to ensure strong consistency across multiple nodes, making it suitable for critical configuration data and service coordination. The server forms the backbone of Kubernetes cluster state management and is used extensively in cloud-native architectures for configuration management, service discovery, and distributed locking. Its simple HTTP/gRPC API and watch functionality enable applications to respond to configuration changes in real-time. etcd prioritizes consistency and availability, making it ideal for storing cluster membership, feature flags, and other distributed system metadata.

How do I run a basic etcd example?

Run `etcd` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --name _name_ do in etcd?

Human-readable node name.