从远程客户端访问 Windows Server 2008 R2 上的 SQL Server

发布于 2024-11-02 10:05:44 字数 664 浏览 1 评论 0原文

目前,我们正在从使用安装在远程 CentOS 机器上的 PostgreSQL 转向使用安装在远程 Windows Server 2008 R2 机器上的 MS SQL Server 2008 R2。

我们使用该数据库的 Web 应用程序安装并运行在另一个 CentOS 机器上,该机器将保留在该机器上。

所有这些盒子均由第三方托管提供商提供,并且都位于同一域网络上。

因此,我们的开发远离服务器/数据库域,因为我们的开发机器是远程的。在过去,打开 VPN 足以让我们在 PC 上本地运行的 Web 应用程序的开发实例远程连接到在 CentOS 机器上运行的 PostgreSQL 数据库。

然而现在我们在 Windows Server 2008 R2 机器上做同样的事情时遇到了麻烦。即使 VPN 打开,任何连接(甚至 ping)远程服务器计算机的尝试也会超时。

我们用于连接到新数据库服务器上的数据库实例的代码是正确的,因为当我们将该代码上传到 CentOS 应用程序盒并运行它时,它连接良好,因为代码现在在同一物理域中的盒子上运行作为 Windows Server 2008 R2 盒子。然而,我们需要从远程开发机器建立连接。

这有道理吗? 我们是否需要更改一些 Windows 防火墙设置以允许远程连接? 正如我所说,我们甚至无法从远程设备 PING 新的 Windows Server 2008 R2 计算机。

We are currently shifting from using PostgreSQL installed on remote CentOS boxes to using MS SQL Server 2008 R2 installed on remote Windows Server 2008 R2 boxes.

Our web application that uses this database is installed and running on another CentOS box where it will remain.

All of these boxes are provided by a 3rd party hosting provider and are all on the same domain network.

Our development is therefore remote from the server/database domain as our development machines are remote. In the past opening a VPN was enough to allow our development instances of our web app running locally on our PCs to connect remotely to the PostgreSQL database running on the CentOS box.

However now we are having trouble doing the same with the Windows Server 2008 R2 box. Even with the VPN open any attempt to connect (or even ping) the remote server machine times out.

Our code to get a connection to the database instance on the new database server is correct as when we upload that code onto the CentOS application box and run it, it connects fine, as the code is now running on a box in the same physical domain as the Windows Server 2008 R2 box. However we need to make a connection from remote development machines.

Does this make sense?
Are there some windows firewall settings we need to change to allow remote connections?
As I said, we can't even PING the new Windows Server 2008 R2 machine from remote boxes.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

一萌ing 2024-11-09 10:05:44

以下是对我来说使远程连接正常工作的方法的总结。我不是这方面的专家,因此我的某些步骤可能没有必要。我从这个问题的其他答案中采取了一些步骤。

  • 打开 SQL Server 配置管理器
  • 选择 SQL Server 网络配置 选择
  • SQL Server 实例 确保
  • 启用 TCP/IP 协议
  • 右键单击​​ TCP/IP 协议
  • 选择属性
  • 单击 IP 地址选项卡
  • 向下滚动到 IP4。服务器的IP地址应该在这里。将“活动”设置为“是”并将“启用”设置为“是”。将 TCP 端口设置为 1433(不知道这是否有必要。专家可以评论一下)
  • 向下滚动到 IPAll。将TCP端口设置为1433
  • 为端口1433制定入站防火墙规则
  • 打开sql server management studio,右键单击服务器实例,属性->连接->连接允许远程连接。安全-> SQL Server 和 Windows 身份验证模式
  • 重新启动 sql server 服务
  • 重新启动 sql server 浏览器,

就像另一个答案所说,您还必须在客户端中使用正确的连接字符串。

Here is a summary of what worked for me to get remote connections working. I am not an expert in this so some of my steps may not be necessary. I took some of the steps from other answers to this question.

  • Open SQL Server Configuration Manager
  • Select SQL Server Network Configuration
  • Chose your instance of SQL Server
  • Make sure that TCP/IP protocol is enabled
  • Right click TCP/IP protocol
  • Select properties
  • Click IP addresses tab
  • Scroll down to IP4. The IP address of the server should be here. Set active to yes and enabled to yes. Set TCP port to 1433 (don't know if this is necessary. Can some expert comment)
  • Scroll down to IPAll. Set TCP port to 1433
  • Make an inbound firewall rule for port 1433
  • open sql server management studio, right click server instance, properties->connections-> allow remote connections. Security-> SQL Server and Windows Authentication mode
  • restart sql server service
  • restart sql server browser

like another answer says you must also use the correct connection string in your client.

围归者 2024-11-09 10:05:44

执行以下操作:

  1. 打开 SQL Server 配置管理器
  2. 选择 SQL Server 网络配置
  3. 选择 SQL Server 实例
  4. 确保TCP/IP 协议已启用已启用
  5. 如果服务器已关闭,请重新启动服务器

考虑以下事项:

  • 身份验证模式(Windows /SQL Server / 混合)
    • Windows 用户权限
  • 连接字符串中的服务器名称
    • <机器名称>\<实例名称> (相互物理网络)
    • tcp:\(不同的物理网络)

Do the following:

  1. Open SQL Server Configuration Manager
  2. Select SQL Server Network Configuration
  3. Chose your instance of a SQL Server
  4. Make sure that TCP/IP protocol is enabled
  5. Restart server if it was off

Consider the following things:

  • Authentication mode (Windows /SQL Server / mixed)
    • Windows users permissions
  • Server name in the connection string
    • <machine_name>\<instance_name> (mutual physical network)
    • tcp:<ip_address>\<instance_name> (different physical networks)
信愁 2024-11-09 10:05:44

确保您已解锁用于 SQL Server 的 1433 端口。如果您的实例已命名,您需要在配置管理器中为此实例设置端口,然后在防火墙中取消阻止该端口。

Make sure you unblocked 1433 port which is used for SQL Server. If your instance is named, you need to set up port for this instance in configuration manager and then unblock this port in firewall.

南街九尾狐 2024-11-09 10:05:44

结合其他答案的提示和我们的托管提供商的帮助,我们设法解决了这个问题。这主要是这些端口被我们的提供商阻止的问题。

Combined with tips from the other answers and help from our hosting provider we managed to sort this out. It was mostly an issue of those ports being blocked by our provider.

神也荒唐 2024-11-09 10:05:44

我知道这是一篇旧帖子,但要检查的另一件事是确保您已在 SQL Server 网络配置的 IP 地址选项卡上启用特定的 IP 地址和端口,这是对其他帖子的补充。请参阅此链接了解更多信息

I understand that this is an old post but one other thing to check is to make sure that you have enabled a particular IP Address and Port on the IP Address Tab of SQL Server Network Configuration, this is in addition to the other posts. See this LINK for further information

趁微风不噪 2024-11-09 10:05:44

如果配置IP等之后仍然有问题。

请检查您的客户端电脑的日期时间。

它应该与服务器相同

[我最近用这种技术解决了]

如果客户端计算机与服务器时间不同步客户端不连接到服务器,则sql服务器中存在问题。

If there is still a problem after Ip configuration and other things.

please check datetime of your client pc.

it should be same as server

[i have solved recently with this technique]

there is a problem in sql server if client machine is not synced with server time client do not connect to server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文