热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

443CHapter5.DesigningSQLServerEndpoints

Designing SQL Server Endpoints Lesson 1:  Overview of Endpoint Endpoints contro

Designing SQL Server Endpoints


Lesson 1:  Overview of Endpoint


Endpoints control the capability to connect to an instance of SQL Server as well as dictating the communications methods that are acceptable.


1. Endpoint types of payloads


An endpoint has two basic parts: a transport and payload.


Transport Payload


TCP TSQL


TCP SERVICE BROKER


TCP DATABASE MIRRORING


HTTP SOAP


By combing an endpoint transport and payload, SQL Server can filter acceptable traffic before a command event reached the SQL Server instance. (First the validate the transport and payload, then authenticate)


2. Endpoint access


(1) Even if traffic going to the endpoint matches the correct transport and payload, a connection is still not allowed unless access has been granted on the endpoint.


(2) The first layer of access security is determined by the endpoint state. An endpoint can have one of three states: STARTED, STOPPED, and DISABLED. 


 STARTED: The endpoint is actively listening for connections and will replay to an application


 STOPPED: The endpoint is actively listening, but returns a connection error to an application


 DISABLED: The endpoint does not listen and does not respond to any connection attempted


(3) The second layer of security is permission to connect to the endpoint. An application muse have a login created in SQL Server hat has the CONNECT permission granted on the endpoint before the connection is allowed through the endpoint.


(4) SQL Server 2005 ensures that only valid requests can be submitted by a valid user before a request is scheduled within the engine.  Administrators also have a master switch to immediately shut off access if they feel someone is attempting to compromise their SQL Server, by setting the state of the endpoint being used to DISABLED


3. Practice: Inspecting existing endpoints


select * from sys.endpoints


select * from sys.tcp_endpoints


select * from sys.http_endpoints


select * from sys.database_mirroring_endpoints


select * from sys.service_broker_endpoints

Lesson 2:  TCP Endpoints


1. TCP protocol arguments


(1) TCP endpoints are configured to listen on specific IP addresses and port numbers. The two arguments that can be specified that are universal for all TCP endpoints are the following. LISENER_PORT and LISENER_IP.


(2) LISENER_PORT argument is required. The TCP or TSQL endpoint that is created for each instance during installation is already configured for port 1433 o the alternative port number for the instance.


(3) LISENER_IP argument is an optional argument that can provide a powerful security layer for some types of applications. You can specify a specific IP address for the endpoint to listen on. The default setting is ALL.


2. Database mirroring and service broker common arguments


(1) Database mirroring and service broker endpoints provide options to specify the authentication method and the encryption setting. You can use either Microsoft Windows-based authentication or certificates.


(2) Windows-based authentication: NTLM, KERBEROS, NEGOTIATE (Negotiate means that dynamical select the authentication method.)


(3) Best practices


 If the same domain or across trusted domain, use the Windows-based authentication


 If different non-trusted domain, use the certification


(4) All communication between endpoints can be encrypted, and you can specify which algorithm to use for the communications. The default algorithm is RC4, but you can specify the much stronger advanced encryption standard (AES) algorithm.


3. Database mirroring specific arguments


(1) Database mirroring endpoints include a third argument related to the role within the database mirroring session.


(2) Database mirroring endpoints role


Role Description


PARTNER The endpoint can be only as the principal or the mirror


WITNESS The endpoint can be only as the witness


ALL The endpoints can be either partner or witness

(3) Other


4. Database mirroring Practice


(1) structure

 

 



(2) preparing works


 Set the recovery mode of the principal to FULL.


 Backup the database on principal


 Restore the database on mirror with NORECOVERY


 Backup the transaction log on principal, restore the transaction log on the mirror


 Transfer to the instance hosting the mirror all logins, jobs, linked server, and other objects external to the database.


--on the principal server


use master


go


backup database DB_Mirror_Sample


to disk = 'c:\test\DB_Mirror_Sample.bak'


with format


go

backup log DB_Mirror_Sample


to disk = 'c:\test\DB_Mirror_Sample_Log.bak'


with norecovery


go

--on the mirroring server


use master


go

restore database DB_Mirror_Sample


from disk='c:\test\DB_Mirror_Sample.bak'


with file=1, norecovery


go

restore log DB_Mirror_Sample


from disk='c:\test\DB_Mirror_Sample_Log.bak'


with file=1, norecovery


go


(3) Establishing endpoints.


Enable the database mirror


 


Configure security


 


 


 

Change the SQL Server Service Account for Principal, Mirror, and Witness.


 

 


 


(4) You can change operation mode if possible


Mode Witness Explanation


High performance (asynchronous) N/A To maximize performance, the mirror database always lags somewhat behind the principal database, never quite catching up. However, the gap between the databases is typically small. The loss of a partner has the following effect:


 If the mirror server instance becomes unavailable, the principal continues.


 If the principal server instance becomes unavailable, the mirror stops; but if the session has no witness (as recommended) or the witness is connected to the mirror server, the mirror server is accessible as a warm standby; the database owner can force service to the mirror server instance (with possible data loss).


High safety without automatic failover (synchronous) No All committed transactions are guaranteed to be written to disk on the mirror server.


Manual failover is possible when the partners are connected to each other and the database is synchronized.


The loss of a partner has the following effect:


 If the mirror server instance becomes unavailable, the principal continues.


 If the principal server instance becomes unavailable, the mirror stops but is accessible as a warm standby; the database owner can force service to the mirror server instance (with possible data loss).


High safety with automatic failover (synchronous) Yes All committed transactions are guaranteed to be written to disk on the mirror server.


Availability is maximized by including a witness server instance to support automatic failover. Note that you can select the High safety with automatic failover (synchronous) option only if you have first specified a witness server address.


Manual failover is possible when the partners are connected to each other and the database is synchronized.


Important:  If the witness becomes disconnected, the partners must be connected to each other for the database to be available.

In the presence of a witness, the loss of a partner has the following effect:


 If the principal server instance becomes unavailable, automatic failover occurs. The mirror server instance switches to the role of principal, and it offers its database as the principal database.


 If the mirror server instance becomes unavailable, the principal continues.

 


 


(5) Failover


 

 


(6) Removing the mirror


alter database DB_Mirror_Sample set partner OFF

 


5. Service broker-specific arguments


(1) In addition to authentication modes and encryption, the service broker endpoints implement arguments related to message forwarding.


(2) The MESSAGE_FORWAREDING (DISABLED | ENABLED) option enables messages destined for a different broker instance to be forwarded to a specified forwarding address.


6. Service broker practice


 

use master


go


alter database DB_SB


set enable_broker


go

use DB_SB


go

create master key


encryption by password = 'Pa$$w0rd'


go



--message type


create message type SubmitBOMProduct


validation = well_formed_xml


create message type ReceiveBOM


validation = well_formed_xml


-- create contract


create contract BOMContract


(SubmitBOMProduct sent by initiator,


ReceiveBOM sent by target)



/*create queue*/


--1. create queue


create queue BOMProductQueue


create queue BOMResultQueue


--2 create a service


create service BOMRequestService


on queue BOMProductQueue(BOMContract)


create service BOMResultService


on queue BOMResultQueue(BOMContract)

/*create a conversation*/


declare @dialoghandle uniqueidentifier

begin dialog conversation @dialoghandle


from service BOMRequestService


to service 'BOMResultService'


on contract BOMContract

select @dialoghandle

/*send and reveive message*/


select * from BOMProductQueue


select * from BOMResultQueue

--1. send msg


send on conversation 'AC0996FF-1C16-DE11-AA62-0003FF1D2E78'


message type SubmitBOMProduct


(N'123')

select * from BOMProductQueue


select * from BOMResultQueue



--2. receive msg


receive top(1) *


from BOMResultQueue

select * from BOMProductQueue


select * from BOMResultQueue



Lesson 3:  HTTP Endpoints


1. HTTP endpoint security


(1) In addition to specifying the HTTP protocol with a SOAP payload that restricts the endpoints to accepting only a well-formed SOAP Request, HTTP endpoints provide additional layers of security.


(2) Authentication method


Type details


Windows NTLM, KERBEROS, or NEGOTIATE (dynamic select)


Certificate Use a certificate from a trusted authority or generate your own Windows certificate


(3) Encryption


Clear text or SSL


(4) Login type


Windows or Mixed


(5) Specifying web methods


2. Creating an endpoint


CREATE ENDPOINT    sample_endpoint


STATE = STARTED


AS HTTP


(


    PATH='/hp',


    AUTHENTICATION=(INTEGRATED),


    PORTS=(SSL),


    SSL_PORT = 443,


    SITE='www.sample.com'


)

FOR SOAP


(


    WEBMETHOD 'ListCourse' (NAME='DB_Mirror_Sample.dbo.Course', SCHEMA=DEFAULT,       FORMAT=ALL_RESULTS),


    WSDL = DEFAULT,


    DATABASE = 'DB_Mirror_Sample',


    NAMESPACE='http://temUri.org'


)

 


443 CHapter5.Designing SQL Server Endpoints




推荐阅读
  • Oracle seg,V$TEMPSEG_USAGE与Oracle排序的关系及使用方法
    本文介绍了Oracle seg,V$TEMPSEG_USAGE与Oracle排序之间的关系,V$TEMPSEG_USAGE是V_$SORT_USAGE的同义词,通过查询dba_objects和dba_synonyms视图可以了解到它们的详细信息。同时,还探讨了V$TEMPSEG_USAGE的使用方法。 ... [详细]
  • 本文介绍了lua语言中闭包的特性及其在模式匹配、日期处理、编译和模块化等方面的应用。lua中的闭包是严格遵循词法定界的第一类值,函数可以作为变量自由传递,也可以作为参数传递给其他函数。这些特性使得lua语言具有极大的灵活性,为程序开发带来了便利。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • 本文介绍了Oracle存储过程的基本语法和写法示例,同时还介绍了已命名的系统异常的产生原因。 ... [详细]
  • 本文介绍了在MFC下利用C++和MFC的特性动态创建窗口的方法,包括继承现有的MFC类并加以改造、插入工具栏和状态栏对象的声明等。同时还提到了窗口销毁的处理方法。本文详细介绍了实现方法并给出了相关注意事项。 ... [详细]
  • 解决VS写C#项目导入MySQL数据源报错“You have a usable connection already”问题的正确方法
    本文介绍了在VS写C#项目导入MySQL数据源时出现报错“You have a usable connection already”的问题,并给出了正确的解决方法。详细描述了问题的出现情况和报错信息,并提供了解决该问题的步骤和注意事项。 ... [详细]
  • 拥抱Android Design Support Library新变化(导航视图、悬浮ActionBar)
    转载请注明明桑AndroidAndroid5.0Loollipop作为Android最重要的版本之一,为我们带来了全新的界面风格和设计语言。看起来很受欢迎࿰ ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • Linux环境变量函数getenv、putenv、setenv和unsetenv详解
    本文详细解释了Linux中的环境变量函数getenv、putenv、setenv和unsetenv的用法和功能。通过使用这些函数,可以获取、设置和删除环境变量的值。同时给出了相应的函数原型、参数说明和返回值。通过示例代码演示了如何使用getenv函数获取环境变量的值,并打印出来。 ... [详细]
  • 在开发app时,使用了butterknife后,在androidStudio打包apk时可能会遇到报错。为了解决这个问题,可以通过打开proguard-rules.pro文件进行代码混淆来解决。本文介绍了具体的混淆代码和方法。 ... [详细]
  • 怎么在PHP项目中实现一个HTTP断点续传功能发布时间:2021-01-1916:26:06来源:亿速云阅读:96作者:Le ... [详细]
  • Python爬虫中使用正则表达式的方法和注意事项
    本文介绍了在Python爬虫中使用正则表达式的方法和注意事项。首先解释了爬虫的四个主要步骤,并强调了正则表达式在数据处理中的重要性。然后详细介绍了正则表达式的概念和用法,包括检索、替换和过滤文本的功能。同时提到了re模块是Python内置的用于处理正则表达式的模块,并给出了使用正则表达式时需要注意的特殊字符转义和原始字符串的用法。通过本文的学习,读者可以掌握在Python爬虫中使用正则表达式的技巧和方法。 ... [详细]
author-avatar
k34458814
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有