다음을 통해 공유


엔드포인트 구현

적용 대상: SQL ServerAzure SQL Database Azure SQL Managed Instance Azure Synapse Analytics

엔드포인트는 기본적으로 요청을 수신할 수 있는 서비스입니다. SMO는 개체를 사용하여 다양한 유형의 엔드포인트를 Endpoint 지원합니다. 개체의 인스턴스를 만들고 해당 속성을 설정하여 특정 프로토콜을 사용하는 특정 유형의 페이로드를 Endpoint 처리하는 엔드포인트 서비스를 만들 수 있습니다.

EndpointType 개체의 Endpoint 속성을 사용하여 다음 페이로드 형식을 지정할 수 있습니다.

  • 데이터베이스 미러링

  • SOAP(SOAP 엔드포인트에 대한 지원은 SQL Server 2008 R2(10.50.x) 및 이전 SQL Server 버전에 있음)

  • Service Broker

  • Transact-SQL

또한 ProtocolType 속성을 사용하여 다음 두 가지 지원 프로토콜을 지정할 수 있습니다.

  • HTTP 프로토콜

  • TCP 프로토콜

페이로드 유형을 지정한 경우 Payload 개체 속성을 사용하여 실제 페이로드를 설정할 수 있습니다. Payload 개체 속성은 지정된 유형의 페이로드 개체에 대한 참조를 제공하며 이에 대한 속성을 수정할 수 있습니다.

개체의 DatabaseMirroringPayload 경우 미러링 역할과 암호화 사용 여부를 지정해야 합니다. 개체에는 ServiceBrokerPayload 메시지 전달, 허용되는 최대 연결 수 및 인증 모드에 대한 정보가 필요합니다. 이 개체를 SoapPayloadMethod 사용하려면 클라이언트에서 사용할 수 있는 SOAP 페이로드 메서드(저장 프로시저 및 사용자 정의 함수)를 지정하는 개체 속성을 포함하여 Add 다양한 속성을 설정해야 합니다.

마찬가지로 실제 프로토콜은 속성에 지정된 ProtocolType 형식의 Protocol 프로토콜 개체를 참조하는 개체 속성을 사용하여 설정할 수 있습니다. 개체에는 HttpProtocol 제한된 IP 주소 목록과 포트, 웹 사이트 및 인증 정보가 필요합니다. TcpProtocol 개체에도 제한된 IP 주소 목록과 포트 정보가 필요합니다.

엔드포인트가 만들어지고 완전히 정의되었으면 데이터베이스 사용자, 그룹, 역할 및 로그온에 대해 액세스를 부여, 취소 및 거부할 수 있습니다.

예시

다음 코드 예제에서는 프로그래밍 환경, 프로그래밍 템플릿 및 프로그래밍 언어를 선택하여 애플리케이션을 만들어야 합니다. 자세한 내용은 Visual Studio .NET에서 Visual C# SMO 프로젝트 만들기를 참조하세요.

Visual Basic에서 데이터베이스 미러링 엔드포인트 서비스 만들기

코드 예제에서는 SMO에서 데이터베이스 미러링 엔드포인트를 만드는 방법을 보여 줍니다. 데이터베이스 미러를 만들기 전에 이 작업이 필요합니다. 개체의 IsMirroringEnabled 속성 및 기타 속성을 Database 사용하여 데이터베이스 미러를 만듭니다.

'Set up a database mirroring endpoint on the server before setting up a database mirror.
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Define an Endpoint object variable for database mirroring.
Dim ep As Endpoint
ep = New Endpoint(srv, "Mirroring_Endpoint")
ep.ProtocolType = ProtocolType.Tcp
ep.EndpointType = EndpointType.DatabaseMirroring
'Specify the protocol ports.
ep.Protocol.Http.SslPort = 5024
ep.Protocol.Tcp.ListenerPort = 6666
'Specify the role of the payload.
ep.Payload.DatabaseMirroring.ServerMirroringRole = ServerMirroringRole.All
'Create the endpoint on the instance of SQL Server.
ep.Create()
'Start the endpoint.
ep.Start()
Console.WriteLine(ep.EndpointState)

Visual C에서 데이터베이스 미러링 엔드포인트 서비스 만들기#

코드 예제에서는 SMO에서 데이터베이스 미러링 엔드포인트를 만드는 방법을 보여 줍니다. 데이터베이스 미러를 만들기 전에 이 작업이 필요합니다. 개체의 IsMirroringEnabled 속성 및 기타 속성을 Database 사용하여 데이터베이스 미러를 만듭니다.

{  
            //Set up a database mirroring endpoint on the server before   
        //setting up a database mirror.   
        //Connect to the local, default instance of SQL Server.   
            Server srv = new Server();  
            //Define an Endpoint object variable for database mirroring.   
            Endpoint ep = default(Endpoint);  
            ep = new Endpoint(srv, "Mirroring_Endpoint");  
            ep.ProtocolType = ProtocolType.Tcp;  
            ep.EndpointType = EndpointType.DatabaseMirroring;  
            //Specify the protocol ports.   
            ep.Protocol.Http.SslPort = 5024;  
            ep.Protocol.Tcp.ListenerPort = 6666;  
            //Specify the role of the payload.   
            ep.Payload.DatabaseMirroring.ServerMirroringRole = ServerMirroringRole.All;  
            //Create the endpoint on the instance of SQL Server.   
            ep.Create();  
            //Start the endpoint.   
            ep.Start();  
            Console.WriteLine(ep.EndpointState);  
        }  

PowerShell에서 데이터베이스 미러링 엔드포인트 서비스 만들기

코드 예제에서는 SMO에서 데이터베이스 미러링 엔드포인트를 만드는 방법을 보여 줍니다. 데이터베이스 미러를 만들기 전에 이 작업이 필요합니다. 개체의 IsMirroringEnabled 속성 및 기타 속성을 Database 사용하여 데이터베이스 미러를 만듭니다.

# Set the path context to the local, default instance of SQL Server.  
CD \sql\localhost\  
$srv = get-item default  
  
#Get a new endpoint to congure and add  
$ep = New-Object -TypeName Microsoft.SqlServer.Management.SMO.Endpoint -argumentlist $srv,"Mirroring_Endpoint"  
  
#Set some properties  
$ep.ProtocolType = [Microsoft.SqlServer.Management.SMO.ProtocolType]::Tcp  
$ep.EndpointType = [Microsoft.SqlServer.Management.SMO.EndpointType]::DatabaseMirroring  
$ep.Protocol.Http.SslPort = 5024  
$ep.Protocol.Tcp.ListenerPort = 6666 #inline comment  
$ep.Payload.DatabaseMirroring.ServerMirroringRole = [Microsoft.SqlServer.Management.SMO.ServerMirroringRole]::All  
  
# Create the endpoint on the instance  
$ep.Create()  
  
# Start the endpoint  
$ep.Start()  
  
# Report its state  
$ep.EndpointState;  

참고 항목

데이터베이스 미러링 엔드포인트(SQL Server)