> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> دليل لإعداد اتصال SSL/TLS آمن بين ClickHouse وZooKeeper

# اتصال آمن اختياري بين ClickHouse وZooKeeper

export const CloudNotSupportedBadge = () => {
  return <div className="cloudNotSupportedBadge">
            <div className="cloudNotSupportedIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.5" d="M6.33366 12.6666L12.3739 12.6667C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00003 12.3739 8.00003C12.3739 8.00003 12.3337 7.66659 12.0003 7.33325M10.667 5.33322C8.00033 2.33325 4.45395 4.78537 4.14195 6.68203C2.55728 6.7627 1.29395 8.06203 1.29395 9.6667C1.29395 11.3234 2.66699 12.6666 4.00033 12.6666" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.5" d="M2.66699 14L12.0003 4.66663" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>

        </div>
            غير مدعوم في ClickHouse Cloud
        </div>;
};

<CloudNotSupportedBadge />

<Note>
  لا تسري هذه الصفحة على [ClickHouse Cloud](https://clickhouse.com/cloud). ويُنفَّذ الإجراء الموضَّح هنا تلقائيًا في خدمات ClickHouse Cloud.
</Note>

يجب تحديد `ssl.keyStore.location` و`ssl.keyStore.password` و`ssl.trustStore.location` و`ssl.trustStore.password` للاتصال مع ClickHouse client عبر SSL. هذه الخيارات متاحة ابتداءً من الإصدار 3.5.2 من ZooKeeper.

يمكنك إضافة `zookeeper.crt` إلى الشهادات الموثوق بها.

```bash theme={null}
sudo cp zookeeper.crt /usr/local/share/ca-certificates/zookeeper.crt
sudo update-ca-certificates
```

سيكون قسم Client في `config.xml` على النحو التالي:

```xml theme={null}
<client>
    <certificateFile>/etc/clickhouse-server/client.crt</certificateFile>
    <privateKeyFile>/etc/clickhouse-server/client.key</privateKeyFile>
    <loadDefaultCAFile>true</loadDefaultCAFile>
    <cacheSessions>true</cacheSessions>
    <disableProtocols>sslv2,sslv3</disableProtocols>
    <preferServerCiphers>true</preferServerCiphers>
    <invalidCertificateHandler>
        <name>RejectCertificateHandler</name>
    </invalidCertificateHandler>
</client>
```

أضِف Zookeeper إلى تهيئة ClickHouse مع بعض إعدادات العنقود ووحدات الماكرو:

```xml theme={null}
<clickhouse>
    <zookeeper>
        <node>
            <host>localhost</host>
            <port>2281</port>
            <secure>1</secure>
        </node>
    </zookeeper>
</clickhouse>
```

شغّل `clickhouse-server`. في السجلات، من المفترض أن ترى:

```text theme={null}
<Trace> ZooKeeper: initialized, hosts: secure://localhost:2281
```

تدل البادئة `secure://` على أن الاتصال مؤمَّن باستخدام SSL.

للتأكد من أن حركة المرور مشفّرة، شغّل `tcpdump` على المنفذ المؤمَّن:

```bash theme={null}
tcpdump -i any dst port 2281 -nnXS
```

وأجرِ استعلامًا في `clickhouse-client`:

```sql theme={null}
SELECT * FROM system.zookeeper WHERE path = '/';
```

في حالة اتصال غير مُشفَّر، سترى في مخرجات `tcpdump` شيئًا مثل هذا:

```text theme={null}
..../zookeeper/quota.
```

عند استخدام اتصال مشفّر، يجب ألّا ترى هذا.
