安装定制连接器
在编译和打包定制连接器之后,需要将其安装到 Discovery 实例。
IBM Cloud Pak for Data IBM Software Hub
此信息仅适用于已安装的部署。
Discovery 提供了名为 manage_custom_crawler.sh
的脚本,用于安装和卸载定制连接器。 该脚本位于解压缩的 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}
在这里您可以指定以下变量的值:
- 端点:URL,用于您的服务实例。 您可以在 IBM Cloud Pak for Data 管理控制台的服务实例概览页面的访问信息部分获取该值。
- 访问令牌:访问端点所需的承载令牌。 您可以从与端点相同的页面获取该值。
- 爬虫名称:(可选)您为爬虫指定的名称。
{built_connector_zip_file}
是您 编译和打包示例连接器 时创建的文件名。
例如:
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。
验证已安装的连接器
通过登录 Discovery 工具并确保连接器作为选项显示在 配置集合页面上,验证连接器是否已部署到 Discovery 实例。
在 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
脚本
manage_custom_crawler.sh
脚本具有以下内部文档:
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
了解 4.0.5 及更早版本中的 manage_custom_crawler.sh
脚本
manage_custom_crawler.sh
脚本具有以下内部文档:
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.