> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-revert-104359-revert-104251-parquet-single.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> دليل خطوة بخطوة لإعداد Amazon RDS MySQL كمصدر لـ ClickPipes

# دليل إعداد مصدر RDS MySQL

export const IAMAuthentication = ({engine, service, children}) => {
  const services = {
    aurora: {
      name: 'Aurora',
      resource: 'cluster',
      id: 'cluster-xxxxxxxxxxxxxx'
    },
    rds: {
      name: 'RDS',
      resource: 'instance',
      id: 'db-xxxxxxxxxxxxxx'
    }
  };
  const createUserStatements = {
    postgres: `CREATE USER clickpipes_iam_user;
GRANT rds_iam TO clickpipes_iam_user;`,
    mysql: `CREATE USER 'clickpipes_iam_user' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';`
  };
  const svc = services[String(service).toLowerCase()];
  const createUserSql = createUserStatements[String(engine).toLowerCase()];
  if (!svc) throw new Error(`Unsupported IAM authentication service: ${service}`);
  if (!createUserSql) throw new Error(`Unsupported IAM authentication engine: ${engine}`);
  return <>
      <p>
        Instead of a password, you can authenticate the ClickPipes user with an AWS IAM role. This lets ClickPipes connect to your Amazon {svc.name} {svc.resource} without storing database credentials.
      </p>

      <h4 id="enable-iam-authentication">Enable IAM authentication</h4>

      <ol>
        <li>Log in to your AWS account and go to the {svc.name} {svc.resource} you want to configure.</li>
        <li>Click <strong>Modify</strong>.</li>
        <li>Scroll to the <strong>Database authentication</strong> section.</li>
        <li>Select <strong>Password and IAM database authentication</strong>.</li>
        <li>Click <strong>Continue</strong>.</li>
        <li>Review the changes and select <strong>Apply immediately</strong>.</li>
      </ol>

      <h4 id="create-database-user">Create the ClickPipes user</h4>

      <p>Create the ClickPipes user with IAM authentication enabled, then grant it the same schema and replication privileges shown above:</p>

      <CodeBlock language="sql">{createUserSql}</CodeBlock>

      {children}

      <h4 id="obtaining-the-clickhouse-service-iam-role-arn">Obtain the ClickHouse service IAM role ARN</h4>

      <ol>
        <li>Log in to your ClickHouse Cloud account.</li>
        <li>Select the ClickHouse service you want to connect.</li>
        <li>Select the <strong>Settings</strong> tab.</li>
        <li>Scroll to the <strong>Network security information</strong> section at the bottom of the page.</li>
        <li>Copy the service's <strong>Service role ID (IAM)</strong> value, shown below.</li>
      </ol>

      <Frame>
        <img src="/images/cloud/security/secures3_arn.webp" alt="Service role ID (IAM) value in the Network security information section" />
      </Frame>

      <p>This value is your <code>{'{ClickHouse_IAM_ARN}'}</code> — the role ClickPipes uses to access your {svc.name} {svc.resource}.</p>

      <h4 id="obtaining-the-rds-resource-id">Obtain the resource ID</h4>

      <ol>
        <li>Log in to your AWS account and go to the {svc.name} {svc.resource} you want to configure.</li>
        <li>Select the <strong>Configuration</strong> tab.</li>
        <li>Note the <strong>Resource ID</strong> value — it looks like <code>{svc.id}</code>. This is your <code>{'{RDS_RESOURCE_ID}'}</code>, which you reference in the permissions policy.</li>
      </ol>

      <h4 id="manually-create-iam-role">Create the IAM role</h4>

      <ol>
        <li>Log in to your AWS account with an IAM user that has permission to create and manage IAM roles.</li>
        <li>Open the IAM console.</li>
        <li>
          Create a new IAM role with the following trust and permissions policies.

          <p>Trust policy (replace <code>{'{ClickHouse_IAM_ARN}'}</code> with the IAM role ARN of your ClickHouse instance):</p>

          <CodeBlock language="json">{`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "{ClickHouse_IAM_ARN}"
      },
      "Action": [
        "sts:AssumeRole",
        "sts:TagSession"
      ]
    }
  ]
}`}</CodeBlock>

          <p>Permissions policy (replace <code>{'{RDS_RESOURCE_ID}'}</code> with the resource ID of your {svc.name} {svc.resource}, <code>{'{RDS_REGION}'}</code> with its region, and <code>{'{AWS_ACCOUNT}'}</code> with your AWS account ID):</p>

          <CodeBlock language="json">{`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "rds-db:connect"
      ],
      "Resource": [
        "arn:aws:rds-db:{RDS_REGION}:{AWS_ACCOUNT}:dbuser:{RDS_RESOURCE_ID}/clickpipes_iam_user"
      ]
    }
  ]
}`}</CodeBlock>
        </li>
        <li>Once the role is created, copy its ARN. This is your <code>{'{RDS_ACCESS_IAM_ROLE_ARN}'}</code>.</li>
      </ol>

      <p>You can now use this IAM role to authenticate with your {svc.name} {svc.resource} from ClickPipes.</p>
    </>;
};

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

يوضح لك هذا الدليل خطوة بخطوة كيفية تهيئة Amazon RDS MySQL لنسخ البيانات إلى ClickHouse Cloud باستخدام [MySQL ClickPipe](/ar/integrations/clickpipes/mysql/index). للاطلاع على الأسئلة الشائعة المتعلقة بـ MySQL CDC، راجع [صفحة الأسئلة الشائعة لـ MySQL](/ar/integrations/clickpipes/mysql/faq).

<div id="enable-binlog-retention-rds">
  ## تمكين الاحتفاظ بالسجل الثنائي
</div>

السجل الثنائي هو مجموعة من ملفات السجل التي تحتوي على معلومات حول تعديلات البيانات التي أُجريت على مثيل خادم MySQL، وملفات السجل الثنائي مطلوبة للنسخ المتماثل. لتهيئة الاحتفاظ بالسجل الثنائي في RDS MySQL، يجب عليك [تمكين binary logging](#enable-binlog-logging) و[زيادة مدة الاحتفاظ بالـ binlog](#binlog-retention-interval).

<Steps>
  <Step title="تمكين binary logging عبر النسخ الاحتياطي التلقائي" id="enable-binlog-logging">
    تحدد ميزة النسخ الاحتياطية التلقائية ما إذا كان binary logging ممكّنًا أم معطّلًا في MySQL. يمكن تهيئة النسخ الاحتياطية التلقائية لمثيلك في RDS Console بالانتقال إلى **Modify** > **Additional configuration** > **Backup** وتحديد مربع الاختيار **Enable automated backups** (إذا لم يكن محددًا بالفعل).

    <Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/source/rds/rds-backups.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=20b0b92648d5b02b969ed6dbc85b0e17" alt="تمكين النسخ الاحتياطية التلقائية في RDS" size="lg" border width="3230" height="530" data-path="images/integrations/data-ingestion/clickpipes/mysql/source/rds/rds-backups.webp" />

    نوصي بضبط **Backup retention period** على قيمة طويلة بشكل معقول، وفقًا لحالة استخدام النسخ المتماثل.
  </Step>

  <Step title="زيادة مدة الاحتفاظ بالـ binlog" id="binlog-retention-interval">
    <Warning>
      إذا حاولت ClickPipes استئناف النسخ المتماثل وكانت ملفات binlog المطلوبة قد حُذفت بسبب قيمة الاحتفاظ بالـ binlog المُعدّة، فسينتقل ClickPipe إلى حالة خطأ وستلزم إعادة المزامنة.
    </Warning>

    يحذف Amazon RDS، افتراضيًا، السجل الثنائي بأسرع وقت ممكن (أي *الحذف المؤجل*). نوصي بزيادة مدة الاحتفاظ بالـ binlog إلى **72 ساعة** على الأقل لضمان توفر ملفات السجل الثنائي لعمليات النسخ المتماثل في حالات الفشل. لتعيين مدة احتفاظ للسجل الثنائي ([`binlog retention hours`](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql-stored-proc-configuring.html#mysql_rds_set_configuration-usage-notes.binlog-retention-hours))، استخدم الإجراء [`mysql.rds_set_configuration`](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql-stored-proc-configuring.html#mysql_rds_set_configuration):

    [//]: # "ملاحظة: يوصي معظم موفري CDC بأقصى مدة احتفاظ في RDS (7 أيام/168 ساعة). ونظرًا إلى أن ذلك يؤثر في استخدام القرص، فإننا نوصي، من باب التحوّط، بحد أدنى قدره 3 أيام/72 ساعة."

    ```text theme={null}
    mysql=> call mysql.rds_set_configuration('binlog retention hours', 72);
    ```

    إذا لم يتم ضبط هذا الإعداد أو تم ضبطه على فترة زمنية قصيرة جدًا، فقد يؤدي ذلك إلى حدوث فجوات في سجلات السجل الثنائي، مما يحدّ من قدرة ClickPipes على استئناف النسخ المتماثل.
  </Step>
</Steps>

<div id="binlog-settings">
  ## اضبط إعدادات binlog
</div>

يمكن العثور على مجموعة المعلمات عند النقر على مثيل MySQL الخاص بك في RDS Console، ثم الانتقال إلى علامة التبويب **Configuration**.

<Tip>
  إذا كان لديك عنقود MySQL، فيمكن العثور على المعلمات أدناه في مجموعة المعلمات الخاصة بـ [DB cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithParamGroups.CreatingCluster.html) بدلًا من مجموعة معلمات مثيل DB.
</Tip>

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/rds_config.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=85f8ef5f245843997e37aff4af00a67f" alt="مكان العثور على مجموعة المعلمات في RDS" size="lg" border width="708" height="853" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/rds_config.webp" />

<br />

انقر على رابط مجموعة المعلمات، وسيأخذك ذلك إلى صفحتها المخصصة. ينبغي أن ترى زر **Edit** في أعلى اليمين.

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/edit_button.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=56dd2c8547d89b8f8b484788dcc8afce" alt="تحرير مجموعة المعلمات" size="lg" border width="1662" height="292" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/edit_button.webp" />

يلزم ضبط المعلمات التالية على النحو الآتي:

1. اضبط `binlog_format` على `ROW`.

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_format.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=6e04eaf8367baea37adf3646eed9f2c0" alt="تنسيق binlog إلى ROW" size="lg" border width="960" height="232" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_format.webp" />

2. اضبط `binlog_row_metadata` على `FULL`

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_metadata.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=d386fba4441470da3e99db913b7590f1" alt="البيانات الوصفية لصفوف binlog إلى FULL" size="lg" border width="934" height="234" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_metadata.webp" />

3. اضبط `binlog_row_image` على `FULL`

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_image.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=575ce2aa831b497570fa71031e739487" alt="صورة صف binlog إلى FULL" size="lg" border width="934" height="234" data-path="images/integrations/data-ingestion/clickpipes/mysql/parameter_group/binlog_row_image.webp" />

<br />

بعد ذلك، انقر على **Save Changes** في الزاوية العلوية اليمنى. قد تحتاج إلى إعادة تشغيل المثيل لكي تسري التغييرات — ويمكنك معرفة ذلك إذا رأيت `Pending reboot` بجانب رابط مجموعة المعلمات في علامة التبويب **Configuration** ضمن مثيل RDS.

<div id="gtid-mode">
  ## فعِّل وضع GTID
</div>

<Tip>
  يدعم MySQL ClickPipe أيضًا النسخ المتماثل من دون وضع GTID. ومع ذلك، يُوصى بتمكين وضع GTID لتحسين الأداء وتسهيل استكشاف الأخطاء وإصلاحها.
</Tip>

تُعد [Global Transaction Identifiers (GTIDs)](https://dev.mysql.com/doc/refman/8.0/en/replication-gtids.html) معرّفات فريدة تُسنَد إلى كل معاملة تم اعتمادها في MySQL. وهي تُبسّط النسخ المتماثل عبر binlog وتجعل استكشاف الأخطاء وإصلاحها أكثر سهولة. **نوصي** بتمكين وضع GTID حتى يتمكن MySQL ClickPipe من استخدام النسخ المتماثل المستند إلى GTID.

النسخ المتماثل المستند إلى GTID مدعوم في Amazon RDS for MySQL للإصدارات 5.7 و8.0 و8.4. لتمكين وضع GTID لمثيل Aurora MySQL لديك، اتبع الخطوات التالية:

1. في RDS Console، انقر على مثيل MySQL الخاص بك.
2. انقر على علامة التبويب **Configuration**.
3. انقر على رابط مجموعة المعلمات.
4. انقر على الزر **Edit** في الزاوية العلوية اليمنى.
5. اضبط `enforce_gtid_consistency` على `ON`.
6. اضبط `gtid-mode` على `ON`.
7. انقر على **Save Changes** في الزاوية العلوية اليمنى.
8. أعد تشغيل المثيل لتطبيق التغييرات.

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/enable_gtid.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=c5c0a8fbdf44ed38c08bbc6d40b3fef8" alt="تم تمكين GTID" size="lg" border width="1650" height="469" data-path="images/integrations/data-ingestion/clickpipes/mysql/enable_gtid.webp" />

<br />

<Tip>
  يدعم MySQL ClickPipe أيضًا النسخ المتماثل من دون وضع GTID. ومع ذلك، يُوصى بتمكين وضع GTID لتحسين الأداء وتسهيل استكشاف الأخطاء وإصلاحها.
</Tip>

<div id="configure-database-user">
  ## إعداد مستخدم لقاعدة البيانات
</div>

اتصل بمثيل RDS MySQL الخاص بك كمستخدم مسؤول، ثم نفّذ الأوامر التالية:

1. أنشئ مستخدمًا مخصصًا لـ ClickPipes:

   ```sql theme={null}
   CREATE USER 'clickpipes_user'@'host' IDENTIFIED BY 'some-password';
   ```

2. امنح أذونات المخطط. يوضّح المثال التالي الأذونات الخاصة بقاعدة البيانات `mysql`. كرّر هذه الأوامر لكل قاعدة بيانات ولكل مضيف تريد إجراء النسخ المتماثل منهما:

   ```sql theme={null}
   GRANT SELECT ON `mysql`.* TO 'clickpipes_user'@'host';
   ```

3. امنح المستخدم أذونات النسخ المتماثل:

   ```sql theme={null}
   GRANT REPLICATION CLIENT ON *.* TO 'clickpipes_user'@'%';
   GRANT REPLICATION SLAVE ON *.* TO 'clickpipes_user'@'%';
   ```

<div id="iam-authentication">
  ### استخدام مصادقة IAM (اختياري)
</div>

<IAMAuthentication engine="mysql" service="rds" />

<div id="configure-network-access">
  ## إعداد الوصول إلى الشبكة
</div>

<div id="ip-based-access-control">
  ### التحكم في الوصول المستند إلى عناوين IP
</div>

لتقييد حركة المرور إلى مثيل Aurora MySQL لديك، أضف [عناوين IP الثابتة لـ NAT الموثقة](/ar/integrations/clickpipes/networking/static-ips) إلى **Inbound rules** في مجموعة أمان RDS الخاصة بك.

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/4ZDv2f4M_2GbJ9Bg/images/integrations/data-ingestion/clickpipes/mysql/source/rds/security-group-in-rds-mysql.webp?fit=max&auto=format&n=4ZDv2f4M_2GbJ9Bg&q=85&s=0ee7eea2b487aec6a24ee9148e6985d6" alt="أين يمكن العثور على مجموعة الأمان في RDS MySQL؟" size="lg" border width="2850" height="994" data-path="images/integrations/data-ingestion/clickpipes/mysql/source/rds/security-group-in-rds-mysql.webp" />

<Image img="https://mintcdn.com/private-7c7dfe99-revert-104359-revert-104251-parquet-single/ICsmB-Qg9LaQwDEB/images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.webp?fit=max&auto=format&n=ICsmB-Qg9LaQwDEB&q=85&s=4734c2f05d130a091c679bf50a0685b1" alt="حرّر Inbound rules لمجموعة الأمان المذكورة أعلاه" size="lg" border width="1800" height="935" data-path="images/integrations/data-ingestion/clickpipes/postgres/source/rds/edit_inbound_rules.webp" />

<div id="private-access-via-aws-privatelink">
  ### الوصول الخاص عبر AWS PrivateLink
</div>

للاتصال بمثيل RDS الخاص بك عبر شبكة خاصة، يمكنك استخدام AWS PrivateLink. اتبع [دليل إعداد AWS PrivateLink لـ ClickPipes](/ar/resources/support-center/knowledge-base/cloud-services/aws-privatelink-setup-for-clickpipes) لإعداد هذا الاتصال.

<div id="next-steps">
  ## الخطوات التالية
</div>

الآن، بعد تهيئة مثيل Amazon RDS MySQL لديك للنسخ المتماثل عبر binlog والاتصال بشكل آمن بـ ClickHouse Cloud، يمكنك [إنشاء أول MySQL ClickPipe](/ar/integrations/clickpipes/mysql/index#create-your-clickpipe). وللاطلاع على الأسئلة الشائعة حول MySQL CDC، راجع [صفحة الأسئلة الشائعة الخاصة بـ MySQL](/ar/integrations/clickpipes/mysql/faq).
