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
Copy file name to clipboardExpand all lines: v2.1/change-data-capture.md
+35-11Lines changed: 35 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,20 @@ The core feature of CDC is the [changefeed](create-changefeed.html). Changefeeds
31
31
32
32
- The `WITH timestamps` option adds an **update timestamp** to each emitted row. It also causes periodic **resolved timestamp** messages to be emitted to each Kafka partition. A resolved timestamp is a guarantee that no (previously unseen) rows with a lower update timestamp will be emitted on that partition.
- Cross-row and cross-table order guarantees are not directly given. However, the resolved timestamp notifications on every Kafka partition can be used to provide strong ordering and global consistency guarantees by buffering records in between timestamp closures.
35
49
36
50
Because CockroachDB supports transactions that can affect any part of the cluster, there is no way to horizontally divide the cluster's transaction log in a way where each piece is independent, so it can't be scaled in the general case.
@@ -94,7 +108,7 @@ In this example, you'll set up a changefeed for a single-node cluster that is co
94
108
$ ./cockroach start --insecure
95
109
~~~
96
110
97
-
2. Download and extract the [Confluent platform](https://www.confluent.io/download/) (which includes Kafka).
111
+
2. Download and extract the [Confluent Open Source platform](https://www.confluent.io/download/) (which includes Kafka).
98
112
99
113
3. Start Confluent:
100
114
@@ -105,28 +119,39 @@ In this example, you'll set up a changefeed for a single-node cluster that is co
105
119
106
120
Only `zookeeper` and `kafka` are needed. To troubleshoot Confluent, see [their docs](https://docs.confluent.io/current/installation/installing_cp.html#zip-and-tar-archives).
107
121
108
-
4. As the `root` user, open the [built-in SQL client](use-the-built-in-sql-client.html):
You are expected to create any Kafka topics with the necessary number of replications and partitions. [Topics can be created manually](https://kafka.apache.org/documentation/#basic_ops_add_topic) or [Kafka brokers can be configured to automatically create topics](https://kafka.apache.org/documentation/#topicconfigs) with a default partition count and replication factor.
131
+
{{site.data.alerts.end}}
132
+
133
+
5. As the `root` user, open the [built-in SQL client](use-the-built-in-sql-client.html):
109
134
110
135
{% include copy-clipboard.html %}
111
136
~~~ shell
112
137
$ cockroach sql --insecure
113
138
~~~
114
139
115
-
5. Create a database called `test`:
140
+
6. Create a database called `test`:
116
141
117
142
{% include copy-clipboard.html %}
118
143
~~~ sql
119
144
> CREATE DATABASE cdc_demo;
120
145
~~~
121
146
122
-
6. Set the database as the default:
147
+
7. Set the database as the default:
123
148
124
149
{% include copy-clipboard.html %}
125
150
~~~ sql
126
151
> SET DATABASE = cdc_demo;
127
152
~~~
128
153
129
-
7. Create a table and add data:
154
+
8. Create a table and add data:
130
155
131
156
{% include copy-clipboard.html %}
132
157
~~~ sql
@@ -147,7 +172,7 @@ In this example, you'll set up a changefeed for a single-node cluster that is co
147
172
> UPDATE office_dogs SET name = 'Petee H' WHERE id = 1;
148
173
~~~
149
174
150
-
8. Start the changefeed:
175
+
9. Start the changefeed:
151
176
152
177
{% include copy-clipboard.html %}
153
178
~~~ sql
@@ -164,7 +189,7 @@ In this example, you'll set up a changefeed for a single-node cluster that is co
164
189
165
190
This will start up the changefeed in the background and return the `job_id`. The changefeed writes to Kafka.
166
191
167
-
9. In a new terminal, start watching the Kafka topic:
192
+
10. In a new terminal, start watching the Kafka topic:
168
193
169
194
{% include copy-clipboard.html %}
170
195
~~~ shell
@@ -177,22 +202,22 @@ In this example, you'll set up a changefeed for a single-node cluster that is co
177
202
178
203
Note that the initial scan displays the state of the table as of when the changefeed started (therefore, the initial value of `"Petee"` is missing).
179
204
180
-
10. Back in the SQL client, insert more data:
205
+
11. Back in the SQL client, insert more data:
181
206
182
207
{% include copy-clipboard.html %}
183
208
~~~ sql
184
209
> INSERT INTO office_dogs VALUES (3, 'Ernie');
185
210
~~~
186
211
187
-
11. Back in the terminal where you're watching the Kafka topic, the following output has appeared:
212
+
12. Back in the terminal where you're watching the Kafka topic, the following output has appeared:
188
213
189
214
~~~
190
215
{"id": 3, "name": "Ernie"}
191
216
~~~
192
217
193
218
## Known limitations
194
219
195
-
The following are limitations in July 2, 2018 alpha release, and will be addressed before the v2.1 release.
220
+
The following are limitations in the July 30, 2018 alpha release, and will be addressed before the v2.1 release.
196
221
197
222
- Changefeeds created with the alpha may not be compatible with future alphas and the final v2.1 release.
198
223
@@ -201,7 +226,6 @@ The following are limitations in July 2, 2018 alpha release, and will be address
201
226
{{site.data.alerts.end}}
202
227
203
228
- The CockroachDB core changefeed is not ready for external testing.
204
-
- Some intermediate updates on frequently changed rows are never emitted.
205
229
- Changefeed progress is not exposed to the user.
206
230
- The SQL interface is not final and may change.
207
231
- Changefeeds only work on tables with a single [column family](column-families.html) (which is the default for new tables).
0 commit comments