<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 管理連接 > 貢獻者:[@ImPerat0R\_](https://github.com/tssujt)、[@ThinkingChen](https://github.com/cdmikechen) [@zhongjiajie](https://github.com/zhongjiajie) Airflow 需要知道如何連接到您的環境。其他系統和服務的主機名,端口,登錄名和密碼等信息在 UI 的`Admin->Connection`部分中處理。您編寫的 pipeline(管道)代碼將引用 Connection 對象的“conn_id”。 ![https://airflow.apache.org/_images/connections.png](../img/b1caba93dd8fce8b3c81bfb0d58cbf95.jpg) 可以使用 UI 或環境變量創建和管理連接。 有關更多信息,請參閱[Connenctions Concepts](zh/concepts.md)文檔。 ## 使用 UI 創建連接 打開 UI 的`Admin->Connection`部分。 單擊`Create`按鈕以創建新連接。 ![https://airflow.apache.org/_images/connection_create.png](../img/635aacab53c55192ad3e31c28e65eb43.jpg) 1. 使用所需的連接 ID 填寫`Conn Id`字段。建議您使用小寫字符和單獨的帶下劃線的單詞。 2. 使用`Conn Type`字段選擇連接類型。 3. 填寫其余字段。有關屬于不同連接類型的字段的說明,請參閱連接類型。 4. 單擊`Save`按鈕以創建連接。 ## 使用 UI 編輯連接 打開 UI 的`Admin->Connection`部分。 單擊連接列表中要編輯的連接旁邊的鉛筆圖標。 ![https://airflow.apache.org/_images/connection_edit.png](../img/08e0f3fedf871b535c850d202dda1422.jpg) 修改連接屬性,然后單擊`Save`按鈕以保存更改。 ## 使用環境變量創建連接 可以使用環境變量創建 Airflow pipeline(管道)中的連接。環境變量需要具有`AIRFLOW_CONN_`的前綴的 URI 格式才能正確使用連接。 在引用 Airflow pipeline(管道)中的連接時,`conn_id`應該是沒有前綴的變量的名稱。例如,如果`conn_id`名為`postgres_master`,則環境變量應命名為`AIRFLOW_CONN_POSTGRES_MASTER`(請注意,環境變量必須全部為大寫)。Airflow 假定環境變量返回的值為 URI 格式(例如`postgres://user:password@localhost:5432/master`或`s3://accesskey:secretkey@S3` )。 ## 連接類型 ### Google Cloud Platform Google Cloud Platform 連接類型支持[GCP 集成](zh/integration.md) 。 #### 對 GCP 進行身份驗證 有兩種方法可以使用 Airflow 連接到 GCP。 1. 使用[應用程序默認憑據](https://google-auth.readthedocs.io/en/latest/reference/google.auth.html) ,例如在 Google Compute Engine 上運行時通過元數據服務器。 2. 在磁盤上使用[服務帳戶](https://cloud.google.com/docs/authentication/)密鑰文件(JSON 格式)。 #### 默認連接 ID 默認情況下使用以下連接 ID。 ```py bigquery_default ``` 由[`BigQueryHook`](zh/integration.md)鉤子使用。 ```py google_cloud_datastore_default ``` 由[`DatastoreHook`](zh/integration.md)鉤子使用。 ```py google_cloud_default ``` 由[`GoogleCloudBaseHook`](zh/integration.md),[`DataFlowHook`](zh/integration.md),[`DataProcHook`](zh/integration.md),[`MLEngineHook`](zh/integration.md)和[`GoogleCloudStorageHook`](zh/integration.md)掛鉤使用。 #### 配置連接 ##### Project Id (必填) 要連接的 Google Cloud 項目 ID。 ##### Keyfile Path 磁盤上[服務帳戶](https://cloud.google.com/docs/authentication/)密鑰文件(JSON 格式)的路徑。 如果使用應用程序默認憑據則不需要 ##### Keyfile JSON 磁盤上的[服務帳戶](https://cloud.google.com/docs/authentication/)密鑰文件(JSON 格式)的內容。 如果使用此方法進行身份驗證,建議[保護您的連接](zh/howto/secure-connections.md) 。 如果使用應用程序默認憑據則不需要 ##### Scopes (逗號分隔) 要通過身份驗證的逗號分隔[Google 云端范圍](https://developers.google.com/identity/protocols/googlescopes)列表。 > 注意 > 使用應用程序默認憑據時,將忽略范圍。 請參閱[AIRFLOW-2522](https://issues.apache.org/jira/browse/AIRFLOW-2522) 。 ### MySQL MySQL 連接類型允許連接 MySQL 數據庫。 #### 配置連接 ##### 主機(必填) 要連接的主機。 ##### 模式(選填) 指定要在數據庫中使用的模式名稱。 ##### 登陸(必填) 指定要連接的用戶名 ##### 密碼(必填) 指定要連接的密碼 ##### 額外參數(選填) 指定可以在 mysql 連接中使用的額外參數(作為 json 字典)。支持以下參數: - charset:指定連接的 charset - cursor:指定使用的 cursor,為“sscursor”、“dictcurssor”、“ssdictcursor”其中之一 - local_infile:控制 MySQL 的 LOCAL 功能(允許客戶端加載本地數據)。有關詳細信息,請參閱[MySQLdb 文檔](https://mysqlclient.readthedocs.io/user_guide.html)。 - unix_socket:使用 UNIX 套接字而不是默認套接字 - ssl:控制使用 SSL 連接的 SSL 參數字典(這些參數是特定于服務器的,應包含“ca”,“cert”,“key”,“capath”,“cipher”參數。有關詳細信息,請參閱[MySQLdb 文檔](https://mysqlclient.readthedocs.io/user_guide.html)。請注意,以便在 URL 表示法中很有用,此參數也可以是 SSL 字典是字符串編碼的 JSON 字典的字符串。 示例“extras”字段: ```py { "charset": "utf8", "cursorclass": "sscursor", "local_infile": true, "unix_socket": "/var/socket", "ssl": { "cert": "/tmp/client-cert.pem", "ca": "/tmp/server-ca.pem'", "key": "/tmp/client-key.pem" } } ``` 或 ```py { "charset": "utf8", "cursorclass": "sscursor", "local_infile": true, "unix_socket": "/var/socket", "ssl": "{\"cert\": \"/tmp/client-cert.pem\", \"ca\": \"/tmp/server-ca.pem\", \"key\": \"/tmp/client-key.pem\"}" } ``` 將連接指定為 URI(在 AIRFLOW_CONN_ *變量中)時,應按照 DB 連接的標準語法指定它,其中附加項作為 URI 的參數傳遞(請注意,URI 的所有組件都應進行 URL 編碼)。 舉個例子: ```py mysql://mysql_user:XXXXXXXXXXXX@1.1.1.1:3306/mysqldb?ssl=%7B%22cert%22%3A+%22%2Ftmp%2Fclient-cert.pem%22%2C+%22ca%22%3A+%22%2Ftmp%2Fserver-ca.pem%22%2C+%22key%22%3A+%22%2Ftmp%2Fclient-key.pem%22%7D ``` > 注意 > 如果在使用 MySQL 連接時遇到 UnicodeDecodeError,請檢查定義的字符集是否與數據庫字符集匹配。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看