安裝自訂連接器
在編譯和包裝自訂連接器之後,需要將其安裝到 Discovery 實例。
IBM Cloud Pak for Data IBM Software Hub
此資訊僅適用於已安裝的部署。
Discovery 提供了名為 manage_custom_crawler.sh 的 Script,用於安裝和解除安裝自訂連接器。 該 Script 位於展開之 scripts 檔案的 custom-crawler-docs.zip 目錄中,如瞭解 custom-crawler-docs.zip 檔案中所述。
安裝連接器
您可以執行下列步驟,將自訂連接器安裝到 Discovery 實例。
-
確保您已完成用於建立自訂連接器的所有步驟中,截至並包括編譯和包裝範例連接器中所列的那些步驟。
-
在建立並編譯自訂連接器的本端機器目錄中,執行下列指令:
bash scripts/manage_custom_crawler.sh --endpoint {endpoint} --token {access token} deploy -n {crawler name} -f {built_connector_zip_file}在這裡您可以指定下列變數的值:
- endpoint: URL 用於您的服務實例。 您可以從 IBM Cloud Pak for Data 管理主控台的服務實體總覽頁面中的存取資訊部分取得此值。
- 存取標記:存取端點所需的承載符記號。 您可以從與端點相同的頁面取得此值。
- 爬蟲名稱:(可選)您為爬蟲指定的名稱。
{built_connector_zip_file}是您在 Compiling and packing the example connector 中建立的檔案名稱。
例如:
bash scripts/manage_custom_crawler.sh --endpoint https://mycpd.wd40.example.com/discovery/zen40-wd/instances/1638165624521059/api --token eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImVKcV9HY29NcHF5WUFJcVByZ0x0cERRZDNQcmRiTWo5TGg0X09WOEU4MlkifP.eyJ1aXQiOiIxMDAwMzMwOTk5IiwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJBZG1pbiIsInBlcm1pc3Npb25zIjpbImFkbWluaXN0cmF0b3IiLCJjYW5fcHJvdmlzaW9uIl0sImdyb3VwcyI6WzEwMDAwXSwic3ViIjoiYWRtaW4iLCJpc3MiOiJLTk9YU1NPIiwiYXVkIjoiRFNYIiwiaWF0IjoxNjQyNzAyMDA3fQ.5oymGw7pi6tAbTMW9rcdb62G95teR2-tKyznA_wjk_G698fbx1Zl73KZKyEWcTKtyX7IJ1Px5DPdophcqS9i3bPJowHy-ioVp6DML02mscZImhvZPra-e6gwUdhSB64KArmMClo1-kZG20EclNh6-oxR447Bjdsgp7IYpkmynmw0K6vPIqmzwEhr9gAK1vWLOoVd4EoiYNuxZaSFL5byJ0mnQxXzM14w3lKQHZ91WYVKc4JnuJiSVsdpGqVz1JNFmT8D9FBqJQ4uxtshnii0f1Yh-USKCbJmMPXicU8cDtJIfheBejwenfvejUTz5rgZgymYWrGvw3G2oOx_L1Yg-Q deploy -n awesome_crawler -f awesome_crawler.zip您可以指定使用者名稱和密碼參數,而非指定存取標記進行驗證。 如需詳細資訊,請參閱 瞭解
manage_custom_crawler.sh指令碼。
部署自訂爬蟲時,會為連線器指定資源 ID。
驗證已安裝的連接器
Verify that the connector has been deployed to the Discovery instance by logging into the Discovery tooling and ensuring that your connector is displayed as an option on the 設定集合 page.
在 Discovery 上使用已安裝的連接器
若要使用已安裝的自訂連接器,請遵循建立集合中列出的步驟。 自訂連接器會顯示在配置 Cloud Pak for Data 資料來源中提供的連接器清單中。 如需詳細資訊,請參閱 使用 Discovery 工具的自訂連接器。
解除安裝連接器
若要從 Discovery 範例解除安裝自訂連接器,請完成下列步驟:
-
可選:如果您不知道資源 ID,請執行下列指令列出自訂連接器。 傳回連接器的資源 ID。
scripts/manage_custom_crawler.sh --endpoint {endpoint} --token {token} list -
從您解壓縮自訂連接器 ZIP 檔案的目錄執行下列指令,以解除安裝連接器:
scripts/manage_custom_crawler.sh --endpoint {endpoint} --token {token} undeploy --id {crawler_resource_id}其中
{crawler-resource-id}是爬行器部署時產生的 ID。scripts/manage_custom_crawler.sh --endpoint {endpoint} --token {token} undeploy --id {crawler_resource_id}
您可以指定使用者名稱和密碼參數,而非指定存取標記進行驗證。 如需詳細資訊,請參閱 瞭解 manage_custom_crawler.sh 指令碼。
瞭解 manage_custom_crawler.sh Script
manage_custom_crawler.sh Script 具有下列內部文件:
Watson Discovery Custom Crawler Manager
This script will help you deploy, manage, and undeploy your custom crawler for
Watson Discovery.
Subcommands:
deploy Add a new Custom Crawler to your Watson Discovery instance.
undeploy Undeploy your Custom Crawler by name.
list List all Custom Crawlers for your Watson Discovery instance.
Options:
-e --endpoint The endpoint URL for your cluster and add-on service instance
(`https://{cpd_cluster_host}:{port}/discovery/{release}/instances/{instance_id}/api`)
-t --token The authorization token of your Cloud Pak instance
-u --user The user name of your Cloud Pak instance
-p --password The user password of your Cloud Pak instance
If the password is not specified, the command line prompts to input
-n --name The name of the custom crawler to upload (deploy only)
-f --file The path of the custom crawler package to upload (deploy only)
-i --id The crawler_resource_id value to delete the custom crawler (undeploy only)
--help Show this message.
僅限 4.0.5 及更早版本
在 4.0.5 與較早版本中安裝連接器
您可以執行下列步驟,將自訂連接器安裝到 Discovery 實例。
-
確保您已完成用於建立自訂連接器的所有步驟中,截至並包括編譯和包裝範例連接器中所列的那些步驟。
-
在建立並編譯自訂連接器的本端機器目錄中,執行下列指令:
bash scripts/manage_custom_crawler.sh deploy -z {built_connector_zip_file}其中,
{built_connector_zip_file}是編譯和包裝範例連接器中已包裝檔案的名稱。如果您的 Discovery 實例在 Red Hat OpenShift 上執行,請在指令碼中指定
-o或--openshift參數。例如:
bash scripts/manage_custom_crawler.sh deploy -z myCrawler.zip -o true
在 4.0.5 與較早版本中解除安裝連接器
若要從 Discovery 實例解除安裝自訂連接器,請在解壓縮的 custom-crawler-docs.zip 目錄的根目錄中執行下列指令:
bash scripts/manage_custom_crawler.sh undeploy -n {built_connector_name}
其中,{build_connector_name} 是已安裝連接器的名稱,而不是 zip 檔案的名稱。
如果您的 IBM Watson® Discovery 實例在 Red Hat OpenShift 上執行,請在指令碼中指定 -o 或 --openshift 參數。
bash scripts/manage_custom_crawler.sh undeploy -n {built_connector_name} -o true
Understanding the manage_custom_crawler.sh script in 4.0.5 and earlier releases
manage_custom_crawler.sh Script 具有下列內部文件:
Usage: ${BASH_SOURCE[0]} [--pathToZip PATH] [--properties PROPERTIES] [--xml XML]
Watson Discovery Custom Crawler Manager
This script will help you deploy, manage, and undeploy your custom crawler for
Watson Discovery.
Subcommands:
deploy Add a new Custom Crawler to your Watson Discovery instance.
properties Generate the properties file for your crawler.
undeploy Undeploy your Custom Crawler by name.
list List all Custom Crawlers for your Watson Discovery instance.
Options:
-d --discovery The name of the Watson Discovery instance
-z --zipfile The path to the zip file to be uploaded.
For deploy only.
-x --xml The path to the XML file to be uploaded.
For deploy only.
-n --name The name of the Custom Crawler to undeploy.
-m --messages The path to the properties file, used when doing a two part deploy.
For properties only.
-o --openshift Set flag to true if this is an OpenShift Cluster
--help Show this message.