You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> supports using the Snowflake algorithm to generate ID.
79
+
> read the documentation first before deciding to use snowflake. Because once the configuration information is enabled, you can not arbitrarily adjust the configuration information. Failure to do so may result in duplicate ID being generated.
80
+
81
+
The Snowflake algorithm is not enabled by default and needs to be configured in 'conf/config.yaml'.
82
+
83
+
```yaml
84
+
plugin_attr:
85
+
request-id:
86
+
snowflake:
87
+
enable: true
88
+
snowflake_epoc: 1609459200000
89
+
data_machine_bits: 12
90
+
sequence_bits: 10
91
+
data_machine_ttl: 30
92
+
data_machine_interval: 10
93
+
```
94
+
95
+
#### Configuration parameters
96
+
97
+
| Name | Type | Requirement | Default | Valid | Description |
| data_machine_bits | integer | optional | 12 | | Maximum number of supported machines (processes) `1 << data_machine_bits` |
102
+
| sequence_bits | integer | optional | 10 | | Maximum number of generated ID per millisecond per node `1 << sequence_bits` |
103
+
| data_machine_ttl | integer | optional | 30 | | Valid time of registration of 'data_machine' in 'etcd' (unit: seconds) |
104
+
| data_machine_interval | integer | optional | 10 | | Time between 'data_machine' renewal in 'etcd' (unit: seconds) |
105
+
106
+
- `snowflake_epoc`default start time is `2021-01-01T00:00:00Z`, and it can support `69 year` approximately to `2090-09-0715:47:35Z` according to the default configuration
107
+
- `data_machine_bits`corresponds to the set of workIDs and datacEnteridd in the snowflake definition. The plug-in aslocates a unique ID to each process. Maximum number of supported processes is `pow(2, data_machine_bits)`. The default number of `12 bits` is up to `4096`.
108
+
- `sequence_bits`defaults to `10 bits` and each process generates up to `1024` ID per second
109
+
110
+
#### example
111
+
112
+
> Snowflake supports flexible configuration to meet a wide variety of needs
113
+
114
+
- Snowflake original configuration
115
+
116
+
> - Start time 2014-10-20 T15:00:00.000z, accurate to milliseconds. It can last about 69 years
117
+
> - supports up to `1024` processes
118
+
> - Up to `4096` ID per second per process
119
+
120
+
```yaml
121
+
plugin_attr:
122
+
request-id:
123
+
snowflake:
124
+
enable: true
125
+
snowflake_epoc: 1413817200000
126
+
data_machine_bits: 10
127
+
sequence_bits: 12
128
+
```
129
+
75
130
## Disable Plugin
76
131
77
132
Remove the corresponding json configuration in the plugin configuration to disable the `request-id`.
0 commit comments