Skip to content

Commit 63e7cf7

Browse files
committed
[zh] Fix cassandra tutorial translation
1 parent ea0d032 commit 63e7cf7

File tree

1 file changed

+105
-100
lines changed

1 file changed

+105
-100
lines changed

content/zh/docs/tutorials/stateful-application/cassandra.md

Lines changed: 105 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,29 @@ Cassandra, a database, needs persistent storage to provide data durability (appl
1919
In this example, a custom Cassandra seed provider lets the database discover new Cassandra instances as they join the Cassandra cluster.
2020
-->
2121
本教程描述拉如何在 Kubernetes 上运行 [Apache Cassandra](https://cassandra.apache.org/)
22-
数据库 Cassandra 需要永久性存储提供数据持久性(应用 _状态_)。
23-
在此示例中,自定义 Cassandra seed provider 使数据库在加入 Cassandra 集群时发现新的 Cassandra 实例。
22+
数据库 Cassandra 需要永久性存储提供数据持久性(应用“状态”)。
23+
在此示例中,自定义 Cassandra seed provider 使数据库在加入 Cassandra
24+
集群时发现新的 Cassandra 实例。
2425

2526
<!--
2627
*StatefulSets* make it easier to deploy stateful applications into your Kubernetes cluster.
2728
For more information on the features used in this tutorial, see
2829
[StatefulSet](/docs/concepts/workloads/controllers/statefulset/).
2930
-->
30-
使用 *StatefulSets* 可以更轻松地将有状态的应用程序部署到你的 Kubernetes 集群中。
31+
使用"StatefulSets"可以更轻松地将有状态的应用程序部署到你的 Kubernetes 集群中。
3132
有关本教程中使用的功能的更多信息,
3233
参阅 [StatefulSet](/zh/docs/concepts/workloads/controllers/statefulset/)
3334

35+
{{< note >}}
3436
<!--
3537
Cassandra and Kubernetes both use the term _node_ to mean a member of a cluster. In this
3638
tutorial, the Pods that belong to the StatefulSet are Cassandra nodes and are members
3739
of the Cassandra cluster (called a _ring_). When those Pods run in your Kubernetes cluster,
3840
the Kubernetes control plane schedules those Pods onto Kubernetes
3941
{{< glossary_tooltip text="Nodes" term_id="node" >}}.
4042
-->
41-
{{< note >}}
42-
Cassandra 和 Kubernetes 都使用术语 _node_ 来表示集群的成员。
43-
在本教程中,属于 StatefulSet 的 Pod 是 Cassandra 节点,并且是 Cassandra 集群的成员(称为 _ring_)。
43+
Cassandra 和 Kubernetes 都使用术语“节点(node)”来表示集群的成员。
44+
在本教程中,属于 StatefulSet 的 Pod 是 Cassandra 节点,并且是 Cassandra 集群的成员(称为 “ring”)。
4445
当这些 Pod 在你的 Kubernetes 集群中运行时,Kubernetes 控制平面会将这些 Pod 调度到 Kubernetes 的
4546
{{< glossary_tooltip text="节点" term_id="node" >}}上。
4647

@@ -51,7 +52,8 @@ This tutorial deploys a custom Cassandra seed provider that lets the database di
5152
new Cassandra Pods as they appear inside your Kubernetes cluster.
5253
-->
5354
当 Cassandra 节点启动时,使用 _seed列表_ 来引导发现 ring 中其他节点。
54-
本教程部署了一个自定义的 Cassandra seed provider,使数据库可以发现新的 Cassandra Pod 出现在 Kubernetes 集群中。
55+
本教程部署了一个自定义的 Cassandra seed provider,使数据库可以发现新的 Cassandra Pod
56+
出现在 Kubernetes 集群中。
5557
{{< /note >}}
5658

5759
## {{% heading "objectives" %}}
@@ -69,7 +71,6 @@ new Cassandra Pods as they appear inside your Kubernetes cluster.
6971
* 修改 StatefulSet。
7072
* 删除 StatefulSet 及其 {{< glossary_tooltip text="Pod" term_id="pod" >}}.
7173

72-
7374
## {{% heading "prerequisites" %}}
7475

7576
{{< include "task-tutorial-prereqs.md" >}}
@@ -81,7 +82,8 @@ To complete this tutorial, you should already have a basic familiarity with
8182
{{< glossary_tooltip text="StatefulSets" term_id="StatefulSet" >}}.
8283
-->
8384
要完成本教程,你应该已经熟悉 {{< glossary_tooltip text="Pod" term_id="pod" >}},
84-
{{< glossary_tooltip text="Service" term_id="service" >}}和 {{< glossary_tooltip text="StatefulSet" term_id="StatefulSet" >}}。
85+
{{< glossary_tooltip text="Service" term_id="service" >}} 和
86+
{{< glossary_tooltip text="StatefulSet" term_id="StatefulSet" >}}。
8587

8688
<!--
8789
### Additional Minikube setup instructions
@@ -158,7 +160,7 @@ If you don't see a Service named `cassandra`, that means creation failed. Read
158160
for help troubleshooting common issues.
159161
-->
160162
如果没有看到名为 `cassandra` 的服务,则表示创建失败。
161-
请阅读[Debug Services](/zh/docs/tasks/debug-application-cluster/debug-service/),以解决常见问题。
163+
请阅读[调试服务](/zh/docs/tasks/debug-application-cluster/debug-service/),以解决常见问题。
162164

163165
<!--
164166
## Using a StatefulSet to create a Cassandra ring
@@ -212,83 +214,85 @@ kubectl apply -f cassandra-statefulset.yaml
212214
-->
213215
## 验证 Cassandra StatefulSet
214216

215-
1.获取 Cassandra StatefulSet:
217+
1. 获取 Cassandra StatefulSet:
216218

217-
```shell
218-
kubectl get statefulset cassandra
219-
```
219+
```shell
220+
kubectl get statefulset cassandra
221+
```
220222

221-
<!--
223+
<!--
222224
The response should be similar to:
223-
-->
225+
-->
224226
响应应该与此类似:
225227

226-
```
227-
NAME DESIRED CURRENT AGE
228-
cassandra 3 0 13s
229-
```
228+
```
229+
NAME DESIRED CURRENT AGE
230+
cassandra 3 0 13s
231+
```
230232

231-
<!--
233+
<!--
232234
The `StatefulSet` resource deploys Pods sequentially.
235+
-->
236+
`StatefulSet` 资源会按顺序部署 Pod。
233237

238+
<!--
234239
1. Get the Pods to see the ordered creation status:
235240
-->
236-
`StatefulSet` 资源会按顺序部署 Pod。
237-
238-
2.获取 Pod 查看已排序的创建状态:
241+
2. 获取 Pod 查看已排序的创建状态:
239242

240-
```shell
241-
kubectl get pods -l="app=cassandra"
242-
```
243+
```shell
244+
kubectl get pods -l="app=cassandra"
245+
```
243246

244-
<!--
247+
<!--
245248
The response should be similar to:
246-
-->
249+
-->
247250
响应应该与此类似:
248251

249-
```shell
250-
NAME READY STATUS RESTARTS AGE
251-
cassandra-0 1/1 Running 0 1m
252-
cassandra-1 0/1 ContainerCreating 0 8s
253-
```
252+
```
253+
NAME READY STATUS RESTARTS AGE
254+
cassandra-0 1/1 Running 0 1m
255+
cassandra-1 0/1 ContainerCreating 0 8s
256+
```
254257

255-
<!--
258+
<!--
256259
It can take several minutes for all three Pods to deploy. Once they are deployed, the same command
257260
returns output similar to:
258-
-->
261+
-->
259262
这三个 Pod 要花几分钟的时间才能部署。部署之后,相同的命令将返回类似于以下的输出:
260263

261-
```
262-
NAME READY STATUS RESTARTS AGE
263-
cassandra-0 1/1 Running 0 10m
264-
cassandra-1 1/1 Running 0 9m
265-
cassandra-2 1/1 Running 0 8m
266-
```
264+
```
265+
NAME READY STATUS RESTARTS AGE
266+
cassandra-0 1/1 Running 0 10m
267+
cassandra-1 1/1 Running 0 9m
268+
cassandra-2 1/1 Running 0 8m
269+
```
267270
<!--
268271
3. Run the Cassandra [nodetool](https://cwiki.apache.org/confluence/display/CASSANDRA2/NodeTool) inside the first Pod, to
269272
display the status of the ring.
270273
-->
271-
3.运行第一个 Pod 中的 Cassandra [nodetool](https://cwiki.apache.org/confluence/display/CASSANDRA2/NodeTool),以显示 ring 的状态。
274+
3. 运行第一个 Pod 中的 Cassandra [nodetool](https://cwiki.apache.org/confluence/display/CASSANDRA2/NodeTool)
275+
以显示 ring 的状态。
272276

273-
```shell
274-
kubectl exec -it cassandra-0 -- nodetool status
275-
```
277+
```shell
278+
kubectl exec -it cassandra-0 -- nodetool status
279+
```
276280

277-
<!--
281+
<!--
278282
The response should be similar to:
279-
-->
283+
-->
280284
响应应该与此类似:
281285

282-
```
283-
Datacenter: DC1-K8Demo
284-
======================
285-
Status=Up/Down
286-
|/ State=Normal/Leaving/Joining/Moving
287-
-- Address Load Tokens Owns (effective) Host ID Rack
288-
UN 172.17.0.5 83.57 KiB 32 74.0% e2dd09e6-d9d3-477e-96c5-45094c08db0f Rack1-K8Demo
289-
UN 172.17.0.4 101.04 KiB 32 58.8% f89d6835-3a42-4419-92b3-0e62cae1479c Rack1-K8Demo
290-
UN 172.17.0.6 84.74 KiB 32 67.1% a6a1e8c2-3dc5-4417-b1a0-26507af2aaad Rack1-K8Demo
291-
```
286+
```
287+
Datacenter: DC1-K8Demo
288+
======================
289+
Status=Up/Down
290+
|/ State=Normal/Leaving/Joining/Moving
291+
-- Address Load Tokens Owns (effective) Host ID Rack
292+
UN 172.17.0.5 83.57 KiB 32 74.0% e2dd09e6-d9d3-477e-96c5-45094c08db0f Rack1-K8Demo
293+
UN 172.17.0.4 101.04 KiB 32 58.8% f89d6835-3a42-4419-92b3-0e62cae1479c Rack1-K8Demo
294+
UN 172.17.0.6 84.74 KiB 32 67.1% a6a1e8c2-3dc5-4417-b1a0-26507af2aaad Rack1-K8Demo
295+
```
292296

293297
<!--
294298
## Modifying the Cassandra StatefulSet
@@ -301,16 +305,16 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet.
301305

302306
使用 `kubectl edit` 修改 Cassandra StatefulSet 的大小。
303307

304-
1.运行以下命令:
308+
1. 运行以下命令:
305309

306-
```shell
307-
kubectl edit statefulset cassandra
308-
```
310+
```shell
311+
kubectl edit statefulset cassandra
312+
```
309313

310-
<!--
314+
<!--
311315
This command opens an editor in your terminal. The line you need to change is the `replicas` field.
312316
The following sample is an excerpt of the StatefulSet file:
313-
-->
317+
-->
314318
此命令你的终端中打开一个编辑器。需要更改的是 `replicas` 字段。下面是 StatefulSet 文件的片段示例:
315319

316320
```yaml
@@ -340,65 +344,65 @@ Use `kubectl edit` to modify the size of a Cassandra StatefulSet.
340344
341345
1. Get the Cassandra StatefulSet to verify your change:
342346
-->
343-
2.将副本数 (replicas) 更改为 4,然后保存清单。
347+
2. 将副本数(replicas更改为 4,然后保存清单。
344348
345349
StatefulSet 现在可以扩展到运行 4 个 Pod。
346350
347-
3.获取 Cassandra StatefulSet 验证更改:
351+
3. 获取 Cassandra StatefulSet 验证更改:
348352
349-
```shell
350-
kubectl get statefulset cassandra
351-
```
353+
```shell
354+
kubectl get statefulset cassandra
355+
```
352356

353-
<!--
357+
<!--
354358
The response should be similar to:
355-
-->
359+
-->
356360
响应应该与此类似:
357361

358-
```
359-
NAME DESIRED CURRENT AGE
360-
cassandra 4 4 36m
361-
```
362+
```
363+
NAME DESIRED CURRENT AGE
364+
cassandra 4 4 36m
365+
```
362366

363367
## {{% heading "cleanup" %}}
364368

365369
<!--
366370
Deleting or scaling a StatefulSet down does not delete the volumes associated with the StatefulSet.
367371
This setting is for your safety because your data is more valuable than automatically purging all related StatefulSet resources.
368-
369-
{{< warning >}}
370-
Depending on the storage class and reclaim policy, deleting the *PersistentVolumeClaims* may cause the associated volumes
371-
to also be deleted. Never assume you'll be able to access data if its volume claims are deleted.
372-
{{< /warning >}}
373-
374-
1. Run the following commands (chained together into a single command) to delete everything in the Cassandra StatefulSet:
375372
-->
376373
删除或缩小 StatefulSet 不会删除与 StatefulSet 关联的卷。
377374
这个设置是出于安全考虑,因为你的数据比自动清除所有相关的 StatefulSet 资源更有价值。
378375

379376
{{< warning >}}
377+
<!--
378+
Depending on the storage class and reclaim policy, deleting the *PersistentVolumeClaims* may cause the associated volumes
379+
to also be deleted. Never assume you'll be able to access data if its volume claims are deleted.
380+
-->
380381
根据存储类和回收策略,删除 *PersistentVolumeClaims* 可能导致关联的卷也被删除。
381382
千万不要认为其容量声明被删除,你就能访问数据。
382383
{{< /warning >}}
383384

384-
1.运行以下命令(连在一起成为一个单独的命令)删除 Cassandra StatefulSet 中的所有内容:
385+
<!--
386+
1. Run the following commands (chained together into a single command) to delete everything in the Cassandra StatefulSet:
387+
-->
388+
1. 运行以下命令(连在一起成为一个单独的命令)删除 Cassandra StatefulSet 中的所有内容:
385389

386-
```shell
387-
grace=$(kubectl get pod cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \
388-
&& kubectl delete statefulset -l app=cassandra \
389-
&& echo "Sleeping ${grace} seconds" 1>&2 \
390-
&& sleep $grace \
391-
&& kubectl delete persistentvolumeclaim -l app=cassandra
392-
```
390+
```shell
391+
grace=$(kubectl get pod cassandra-0 -o=jsonpath='{.spec.terminationGracePeriodSeconds}') \
392+
&& kubectl delete statefulset -l app=cassandra \
393+
&& echo "Sleeping ${grace} seconds" 1>&2 \
394+
&& sleep $grace \
395+
&& kubectl delete persistentvolumeclaim -l app=cassandra
396+
```
393397

394398
<!--
395399
1. Run the following command to delete the Service you set up for Cassandra:
396400
-->
397-
2.运行以下命令,删除你为 Cassandra 设置的 Service:
401+
2. 运行以下命令,删除你为 Cassandra 设置的 Service:
398402

399-
```shell
400-
kubectl delete service -l app=cassandra
401-
```
403+
```shell
404+
kubectl delete service -l app=cassandra
405+
```
402406

403407
<!--
404408
## Cassandra container environment variables
@@ -412,21 +416,21 @@ This image includes a standard Cassandra installation from the Apache Debian rep
412416
By using environment variables you can change values that are inserted into `cassandra.yaml`.
413417
-->
414418
## Cassandra 容器环境变量
415-
本教程中的 Pod 使用来自 Google [container registry](https://cloud.google.com/container-registry/docs/)
416-
[`gcr.io/google-samples/cassandra:v13`](https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile) 镜像。
417-
上面的 Docker 镜像基于 [debian-base](https://github.com/kubernetes/release/tree/master/images/build/debian-base),并且包含 OpenJDK 8。
419+
420+
本教程中的 Pod 使用来自 Google [容器镜像库](https://cloud.google.com/container-registry/docs/)
421+
[`gcr.io/google-samples/cassandra:v13`](https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile)
422+
镜像。上面的 Docker 镜像基于 [debian-base](https://github.com/kubernetes/release/tree/master/images/build/debian-base)
423+
并且包含 OpenJDK 8。
418424

419425
该映像包括来自 Apache Debian 存储库的标准 Cassandra 安装。
420426
通过使用环境变量,您可以更改插入到 `cassandra.yaml` 中的值。
421427

422-
| Environment variable | Default value |
428+
| 环境变量 | 默认值 |
423429
| ------------------------ |:---------------: |
424430
| `CASSANDRA_CLUSTER_NAME` | `'Test Cluster'` |
425431
| `CASSANDRA_NUM_TOKENS` | `32` |
426432
| `CASSANDRA_RPC_ADDRESS` | `0.0.0.0` |
427433

428-
429-
430434
## {{% heading "whatsnext" %}}
431435

432436
<!--
@@ -437,3 +441,4 @@ By using environment variables you can change values that are inserted into `cas
437441
* 了解如何[扩缩 StatefulSet](/docs/tasks/run-application/scale-stateful-set/)
438442
* 了解有关 [*KubernetesSeedProvider*](https://github.com/kubernetes/examples/blob/master/cassandra/java/src/main/java/io/k8s/cassandra/KubernetesSeedProvider.java) 的更多信息
439443
* 查看更多自定义 [Seed Provider Configurations](https://git.k8s.io/examples/cassandra/java/README.md)
444+

0 commit comments

Comments
 (0)