ai-center
2020.10
false
AI Center
Automation CloudAutomation SuiteStandalone
Last updated 2024年6月6日

2. 配置数据库

要执行此步骤,需要先创建 AI Fabric 安装程序将使用的必要数据库。有两个可用的选项,一个选项是创建多个数据库,另一个选项是创建一个具有多个架构的数据库。

重要提示:
  • 此步骤将创建一个数据库和一个登录名/用户。要完成此步骤,您需要可用于执行这些操作的凭据。在 SQL Server 中,角色分别为 dbcreatorddladmin
  • 相同的 AI Fabric 数据库(通过此步骤创建的数据库)不能在多个 AI Fabric 实例中使用。

配置

  1. 以管理员角色打开 Powershell。
  2. 单击此处以下载脚本,例如使用 Powershell:
    wget https://raw.githubusercontent.com/UiPath/ai-customer-scripts/master/database/createDatabases.ps1 -outfile "createDatabases.ps1"wget https://raw.githubusercontent.com/UiPath/ai-customer-scripts/master/database/createDatabases.ps1 -outfile "createDatabases.ps1"
  3. 您可以输入以下命令来熟悉脚本选项:
    get-help .\)\)createDatabases.ps1 -fullget-help .\)\)createDatabases.ps1 -full
  4. 默认参数适用于大多数场景:
    <h1>If SQL Server can be accessed through Windows Authentication then:
    ./createDatabases.ps1 -sqlinstance "DESKTOP-LOUPTI1\)\)SQLEXPRESS" -windowsAuthentication "Y"</h1><h1>If SQL Server can be accessed through Windows Authentication then:
    ./createDatabases.ps1 -sqlinstance "DESKTOP-LOUPTI1\)\)SQLEXPRESS" -windowsAuthentication "Y"</h1>
    参数 sqlinstance 只是 SQL Server 名称。这就是您在使用 SQL Server Management Studio 时在“服务器名称”字段中输入的内容。例如:

    默认情况下,我们使用多个数据库。如果要使用一个具有多个架构的数据库,可以为 singleDatabase 标志添加 Y,如下所示:
    <h1>If SQL Server can be accessed through Windows Authentication then:
    ./createDatabases.ps1 -sqlinstance "DESKTOP-LOUPTI1\)\)SQLEXPRESS" -windowsAuthentication "Y" -singleDatabase "Y"</h1><h1>If SQL Server can be accessed through Windows Authentication then:
    ./createDatabases.ps1 -sqlinstance "DESKTOP-LOUPTI1\)\)SQLEXPRESS" -windowsAuthentication "Y" -singleDatabase "Y"</h1>

该脚本将输出登录名和密码,用于管理创建的数据库。

请妥善保存此登录名和密码,因为在填写步骤 5.“运行 AI Fabric 应用程序安装程序”的配置屏幕时将需要用到它们。此外,在同一步骤中,您还需要说明是使用多个数据库还是单个数据库,请确保选择正确的数据库,否则预检将失败。

重要提示:
  • 确保已启用 SQL Server 身份验证模式。
  • 确保已将步骤 1 中配置的 Linux 计算机添加到 SQL Server 的已批准 IP 列表中。
  • 确保防火墙规则允许与端口 1433(SQL Server 的默认端口)建立入站连接

手动配置

多个数据库

也可以使用以下手动脚本来创建数据库和角色。修改新登录名 aifadmin 的密码字段,但不要为密码添加单引号或双引号
--Create Databases:
create database ai_deployer;
create database ai_trainer;
create database ai_helper;
create database ai_pkgmanager;
create database ai_appmanager;
USE [master]
GO
CREATE LOGIN [aifadmin] WITH PASSWORD=N'Admin@123!'  -- (Change the Password as per your requirement )
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- create the user on the target database i.e ai_deployer for the login
USE [ai_deployer]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_deployer]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_helper for the login
USE [ai_helper]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_helper]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_trainer for the login
USE [ai_trainer]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_trainer]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_pkgmanager for the login
USE [ai_pkgmanager]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_pkgmanager]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_appmanager for the login
USE [ai_appmanager]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_appmanager]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO--Create Databases:
create database ai_deployer;
create database ai_trainer;
create database ai_helper;
create database ai_pkgmanager;
create database ai_appmanager;
USE [master]
GO
CREATE LOGIN [aifadmin] WITH PASSWORD=N'Admin@123!'  -- (Change the Password as per your requirement )
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- create the user on the target database i.e ai_deployer for the login
USE [ai_deployer]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_deployer]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_helper for the login
USE [ai_helper]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_helper]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_trainer for the login
USE [ai_trainer]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_trainer]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_pkgmanager for the login
USE [ai_pkgmanager]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_pkgmanager]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO
-- create the user on the target database i.e ai_appmanager for the login
USE [ai_appmanager]
GO
CREATE USER [aifadmin] FOR LOGIN [aifadmin]
GO
-- add the user to the desired role
USE [ai_appmanager]
GO
ALTER ROLE [db_owner] ADD MEMBER [aifadmin]
GO

单个数据库

也可以使用以下手动脚本来创建数据库和角色。修改密码字段,但对所有用户使用相同的密码,并且不要添加单引号或双引号。还可以更改用户名,但需要保持相同的架构,末尾带有 _schemaName,如下所示:

//Create Database
create database aifabric
//Create 5 logins
USE [master]
GO
CREATE LOGIN [aifadmin_helper] WITH PASSWORD=N'Admin@123!'  -- (Change the Password as per your requirement )
CREATE LOGIN [aifadmin_pkgmanager] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_deployer] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_trainer] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_appmanager] WITH PASSWORD=N'Admin@123!'
GO
//Map login to user and associate default schema with the user and grant db_ddladmin role to the user 
USE [aifabric]
GO
CREATE USER [aifadmin_helper]  FOR LOGIN  [aifadmin_helper] WITH DEFAULT_SCHEMA = ai_helper
GO
CREATE SCHEMA ai_helper AUTHORIZATION [aifadmin_helper]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_helper';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_pkgmanager] FOR LOGIN  [aifadmin_pkgmanager] WITH DEFAULT_SCHEMA = ai_pkgmanager
GO
CREATE SCHEMA ai_pkgmanager AUTHORIZATION [aifadmin_pkgmanager]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_pkgmanager';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_deployer]   FOR LOGIN  [aifadmin_deployer] WITH DEFAULT_SCHEMA = ai_deployer
GO
CREATE SCHEMA ai_deployer AUTHORIZATION [aifadmin_deployer]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_deployer';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_trainer]    FOR LOGIN  [aifadmin_trainer] WITH DEFAULT_SCHEMA = ai_trainer
GO
CREATE SCHEMA ai_trainer AUTHORIZATION [aifadmin_trainer]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_trainer';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_appmanager] FOR LOGIN  [aifadmin_appmanager] WITH DEFAULT_SCHEMA = ai_appmanager
GO
CREATE SCHEMA ai_appmanager AUTHORIZATION [aifadmin_appmanager]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_appmanager';
GO//Create Database
create database aifabric
//Create 5 logins
USE [master]
GO
CREATE LOGIN [aifadmin_helper] WITH PASSWORD=N'Admin@123!'  -- (Change the Password as per your requirement )
CREATE LOGIN [aifadmin_pkgmanager] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_deployer] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_trainer] WITH PASSWORD=N'Admin@123!'
CREATE LOGIN [aifadmin_appmanager] WITH PASSWORD=N'Admin@123!'
GO
//Map login to user and associate default schema with the user and grant db_ddladmin role to the user 
USE [aifabric]
GO
CREATE USER [aifadmin_helper]  FOR LOGIN  [aifadmin_helper] WITH DEFAULT_SCHEMA = ai_helper
GO
CREATE SCHEMA ai_helper AUTHORIZATION [aifadmin_helper]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_helper';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_pkgmanager] FOR LOGIN  [aifadmin_pkgmanager] WITH DEFAULT_SCHEMA = ai_pkgmanager
GO
CREATE SCHEMA ai_pkgmanager AUTHORIZATION [aifadmin_pkgmanager]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_pkgmanager';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_deployer]   FOR LOGIN  [aifadmin_deployer] WITH DEFAULT_SCHEMA = ai_deployer
GO
CREATE SCHEMA ai_deployer AUTHORIZATION [aifadmin_deployer]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_deployer';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_trainer]    FOR LOGIN  [aifadmin_trainer] WITH DEFAULT_SCHEMA = ai_trainer
GO
CREATE SCHEMA ai_trainer AUTHORIZATION [aifadmin_trainer]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_trainer';
GO
USE [aifabric]
GO
CREATE USER [aifadmin_appmanager] FOR LOGIN  [aifadmin_appmanager] WITH DEFAULT_SCHEMA = ai_appmanager
GO
CREATE SCHEMA ai_appmanager AUTHORIZATION [aifadmin_appmanager]
GO
EXEC sp_addrolemember 'db_ddladmin', 'aifadmin_appmanager';
GO
  • 配置
  • 手动配置
  • 多个数据库
  • 单个数据库

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo White
信任与安全
© 2005-2024 UiPath。保留所有权利。