Mainframe Connector 在 MVS 批量作业的上下文中作为 Java 虚拟机 (JVM) 进程启动。Mainframe Connector 通常使用 JAR 文件进行部署,该文件包含一些必需的依赖项,但 JVM 附带的 IBM 库除外。以下部分详细介绍了 Mainframe Connector 安装流程。
准备工作
- 完成 Mainframe Connector 的初始设置。 初始设置包括向服务账号授予所需角色、为资产设置安全性,以及在大型机与 Google Cloud之间设置网络连接。
- 配置 Java 8 或 Java 17。
- 安装 JZOS Batch Launcher and Toolkit(Java 8 或 Java 17)。
安装 Mainframe Connector
如需安装 Mainframe Connector,请按以下步骤操作:
将预构建的 Mainframe Connector JAR 文件下载到您的用户账号具有写入权限的目录。
重要提示
请注意,Mainframe Connector 使用 Google Analytics 收集使用情况数据。这有助于我们改进软件并提供更好的用户体验。默认情况下,Google Analytics 处于启用状态。 不过,您可以在运行 Mainframe Connector 时配置环境变量来选择停用此功能。
使用 Google Analytics 时,您必须遵守 Google Analytics 的《服务条款》和《隐私权政策》。 下载 Mainframe Connector 即表示您确认已阅读、了解并接受相关条款及条件。将 mainframe-connector-shadow-VERSION-all.jar 文件复制到步骤 8 中显示的 BQSH 作业控制语言 (JCL) 过程的 Java 类路径部分中指定的路径。 VERSION 是 Mainframe Connector 的版本。
如需从大型机访问 Google Cloud 服务,您必须创建服务账号密钥并将其下载为 JSON 密钥文件。如需详细了解如何创建 JSON 密钥文件,请参阅创建服务账号。
使用文件传输协议 (FTP) 以二进制传输模式将 JSON 密钥文件复制到 Unix 文件系统。确保您将未修改的 JSON 密钥文件存储在文件系统中,并保留其原始的 UTF-8 编码。
在 IBM z/OS Unix 文件系统中,没有用于存储 JSON 密钥文件的默认路径。您必须选择只有具有服务账号访问权限的用户才能读取的路径。如果 JSON 密钥文件传输正确,则无法从 UNIX 系统服务 (USS) 读取该文件。
使用二进制模式下的 FTP 将您在第 1 步中下载的 JAR 文件上传到大型机上的以下位置。
/opt/google/mainframe-connector/VERSION/
将 Version 替换为 JAR 文件的版本。
请注意,这是建议用于部署 JAR 文件的路径。您也可以使用网站管理员选择的任何路径。
运行以下命令,验证 JAR 文件是否已正确转移。请注意,
-t选项会列出 JAR 文件的内容。jar -tvf JAR_FILE_NAME
将 JAR_FILE_NAME 替换为 JAR 文件的名称。
复制以下 BQSH JCL 过程。
/BQSH PROC //******************************************************************* //* //* Copyright 2022 Google LLC All Rights Reserved //* //* Licensed under the Apache License, Version 2.0 (the "License"); //* you may not use this file except in compliance with the License. //* You may obtain a copy of the License at //* //* http://www.apache.org/licenses/LICENSE-2.0 //* //* Unless required by applicable law or agreed to in writing, software //* distributed under the License is distributed on an "AS IS" BASIS, //* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //* See the License for the specific language governing permissions and //* limitations under the License. //* //******************************************************************* //BQSH EXEC PGM=JVMLDM86,REGION=0M, // PARM='/+I com.google.cloud.bqsh.Bqsh' //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //CEEDUMP DD SYSOUT=* //ABNLIGNR DD DUMMY //STDIN DD DUMMY //QUERY DD DUMMY //INFILE DD DUMMY //COPYBOOK DD DUMMY //KEYFILE DD DUMMY //STDENV DD *,SYMBOLS=EXECSYS # Service Account Keyfile # Edit the line below to specify a unix filesystem path where # the service account keyfile is stored. # The service account should be granted Storage, BigQuery and Logging permissions. export GKEYFILE="GKEY_FILE_PATH" # Path to directory containing google jar file # Edit this to set actual path selected for your site # it's recommended to have a path with a version identifier # and create a symlink to the directory of the latest version export GOOGLE_DIR="JAR_FILE_PATH" export GOOGLE_CLASSPATH="$GOOGLE_DIR/*" # Do not modify the 3 lines below # Collect system symbols from JES export JOBNAME=&JOBNAME export JOBDATE=&YYMMDD export JOBTIME=&HHMMSS # IBM JZOS JDK Location export JAVA_HOME="/usr/lpp/java/J8.0_64" export PATH="/bin:$JAVA_HOME/bin" # Log Level export BQSH_ROOT_LOGGER=DEBUG # Cloud Logging export LOG_PROJECT="PROJECT_NAME" export LOG_ID="LOG_ID_NAME" # Google Analytics # Uncomment the following line to disable Google Analytics #export DISABLE_ANALYTICS=True # Binary Data Sets # Uncomment the following line to set a default output bucket for scp. # The DSN of the input file is used as the object name. # this may greatly reduce effort across many job steps #export GCSDSNURI="gs://[BUCKET]/[PREFIX]" # Generational Data Sets # Uncomment the line below to set a default output bucket for scp GDG datasets. # The Cloud GDG feature emulates a GDG dataset in a versioned object. # Cloud Storage objects take precedence over local DSN when this is set. #export GCSGDGURI="gs://[BUCKET]/[PREFIX]" # Uncomment the line below to set a default output bucket for the gszutil command. #export GCSOUTURI="gs://[BUCKET]/[PREFIX]" # Mainframe Connector gRPC service # Uncomment and edit the lines below to set the Hostname or IP Address and # port of the gRPC data set transcoding service. # The gRPC service converts z/OS datasets to ORC format on VMs running in # Google Cloud VPC. This is strongly recommended when processing high volumes # of data. #export SRVREMOTE= #export SRVPORT= # Native Libraries export JL="$JH/lib" export LP="/lib:/usr/lib:$JH/bin:$JL/s390x:$JL/s390x/j9vm:$JH/bin/classic" export LIBPATH="$LP:/usr/lib/java_runtime64" # Java Classpath CP="$JL:$JL/ext:/usr/include/java_classes/*" export CLASSPATH="$CP:$GOOGLE_CLASSPATH" # JVM options IJO="-Xms512m -Xmx512m -Xcompressedrefs -Djava.net.preferIPv4Stack=true" IJO="$IJO -Dbqsh.dataset.encoding=IBM-1047" export IBM_JAVA_OPTIONS="$IJO" export JZOS_MAIN_ARGS="" /* // PEND替换以下内容:
- GKEY_FILE_PATH:第 3 步中所述的 JSON 密钥文件的路径。
- JAR_FILE_PATH:包含 JAR 文件的目录的路径。
- PROJECT_NAME:要在 Cloud Logging 中创建日志的项目。
- LOG_ID_NAME:日志的名称。
- 如需停用调试日志记录,请注释掉
BQSH_ROOT_LOGGER=DEBUG这一行。 - 如需将 Mainframe Connector 配置为将日志记录信息写入 Cloud Logging,请设置
LOG_PROJECT和LOG_ID环境变量。 - 如需停用 Google Analytics,请将
DISABLE_ANALYTICS环境变量设置为True。 - 如需指定用于大型机数据集操作(DSN 和 DD)的默认字符编码,请设置
bqsh.dataset.encoding属性。如果在 z/OS 上未设置,Mainframe Connector 会尝试使用native.encoding或sun.jnu.encoding系统属性动态检测编码,并回退到IBM-1047。在非大型机环境中,它会回退到 JVM 默认字符集。
如需查看 Mainframe Connector 支持的环境变量的完整列表,请参阅环境变量。
如需将 Mainframe Connector 配置为与 TLS 拦截代理搭配使用,请在 BQSH JCL 过程中设置以下 Java 系统属性。