关于阿里ECS + RDS的坑

最近公司买了阿里服务器,真他妈的的贵:

ECS: 4 核 8 G 50 内存    489/月 左右具体忘了,前期做外网测试。

RDS:mysql 5.5 低配置  89/月

注意点:

1:ECS 和 RDS 最好把分区分分到一块

2:本地测试一定要和开发环境的,jdk,mysql,tomcat (开发环境)保持一致。

以下是我因为以上的两个问题:遇到数据库链接错误日志

六月 19, 2015 1:26:03 下午 com.mchange.v2.resourcepool.BasicResourcePool
警告: Having failed to acquire a resource, [email protected] is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
六月 19, 2015 1:26:18 下午 com.mchange.v2.resourcepool.BasicResourcePool
警告: com[email protected]32d06b64 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at sun.reflect.GeneratedConstructorAccessor27.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038)
	at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:627)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1013)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2239)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
	at sun.reflect.GeneratedConstructorAccessor24.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1127)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1114)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
	at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1855)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Caused by: java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:209)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:100)
	at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:143)
	at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:173)
	at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2911)
	at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:559)
	... 21 more

六月 19, 2015 1:26:18 下午 com.mchange.v2.resourcepool.BasicResourcePool
警告: Having failed to acquire a resource, [email protected] is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
六月 19, 2015 1:26:33 下午 com.mchange.v2.resourcepool.BasicResourcePool
警告: com[email protected]4a7a8cb4 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at sun.reflect.GeneratedConstructorAccessor27.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038)
	at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:627)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1013)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2239)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
	at sun.reflect.GeneratedConstructorAccessor24.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1127)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1114)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
	at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1855)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
Caused by: java.net.SocketException: Connection reset

前面排查了配置文件,架包很久,都找不到问题出在哪,最后在本地搭建了环境,和开发的一样,结果测试通过。后来检查了下数据库版本,fuck。开发用的是 5.6,RDS买的的是5.5。升级下通过了。

时间: 2024-10-17 06:03:08

关于阿里ECS + RDS的坑的相关文章

阿里云RDS与ECS自建库搭建主从复制

前言 最近尝试在阿里云RDS与ECS自建库之间搭建主从复制,主要是想用于备份数据,所以对于同步一致性要求不是很高.模拟了几次,遇到的一些坑记录在这里,使用的是基于GTID的主从服务,关于GTID: MySQL GTID是在传统的mysql主从复制的基础之上演化而来的产物,即通过UUID加上事务ID的方式来确保每一个事物的唯一性.这样的操作方式使得我们不再需要关心所谓的log_file和log_Pos,只是简单的告诉从库,从哪个服务器上去找主库就OK了.简化了主从的搭建以及failover的过程,

基于阿里云RDS创建ECS自建从库

使用阿里云ECS自建RDS MySQL从库 友情提示:安装MySQL软件步骤本文暂不介绍,安装完MySQL无需着急初始化数据库和启动服务.只需确保安装的MySQL版本不低于阿里云RDS MySQL版本,同时提前新建运行MySQL服务的mysql系统用户.出于安全,部分内容已打马赛克.采用何种模式做主从由RDS MySQL版本决定.本文主要使用RDS MySQL 5.6版作为样例说明,使用新的GTID模式做主从.5.5版配置主从更加简单,前15步操作一样,没有16.17步操作,18步使用binlo

PgSQL · 应用案例 · 阿里云 RDS PostgreSQL 高并发特性 vs 社区版本

摘要: 背景 进程模型数据库,需要为每个会话指派独立的进程与之服务,在连接数非常多,且大都是活跃连接时,进程调度浪费或引入的开销甚至远远大于实际任务需要的开销(例如上下文切换,MEMCPY等),性能下降会较为严重. 背景 进程模型数据库,需要为每个会话指派独立的进程与之服务,在连接数非常多,且大都是活跃连接时,进程调度浪费或引入的开销甚至远远大于实际任务需要的开销(例如上下文切换,MEMCPY等),性能下降会较为严重. PostgreSQL与Oracle Dedicate Server一样,属于

阿里云RDS数据备份本地恢复

公司现在用的阿里云数据库,阿里云上虽然对RDS数据库有备份,也只能免费保存一个月,所以大部分情况需要把备份下载到本地,但是如何在本地恢复可真是话费了一番功夫.先分享如下: 公司目前使用的数据库是阿里云的RDS,目前RDS的版本为mysql5.6.如下: 现在要求把RDS的数据,在公司内部本地进行恢复. 操作系统:Centos7 数据库:mysql5.6 一.安装mysql数据库 在进行RDS本地恢复数据之前,我们需要先在本地服务器上安装mysql的5.6版本,因为RDS是5.6版本,所以我们本地

如何使用脚本自动备份阿里云rds数据库

vim .mysqldump.sh #脚本都放置到/d20141212/scripts下,创建.mysqldump.sh的文件目的是,这个文件里有数据库的连接信息,要隐藏掉.所以加了.. #!/bin/bash shopt -s -o nounset export PATH=/usr/bin/:/bin bakdir=/d20141212/dbback/msyql date=$(date +%Y_%m_%d_%H) dbname='XXX' #数据库名称 dbuser='XXX' #数据库用户

数据从机房迁移到阿里ECS弹性云

首先做的实验是利用到LAMP+vsftpd 实现上传安装wordpress 要求 1: 公司: 已经购买了DNS,阿里ECS云主机 需求: 1:提供FTP上传的用户名和密码 2:需要上传的文件包括:PHP源码文件(WordPress),数据库文件 3:已经确定数据库使用的存储引擎为Innodb存储引擎 请提供解决方案 FPT上传PHP源码: 用户名:php 密码:123456 FTP上传mysql数据库文件 用户名:sql 密码:123456 mysql数据库连接参数 用户名:www 密码:12

专访阿里云RDS团队:WebScaleSQL是一个怎么样的数据库?

2015年1月20日,Facebook宣布阿里巴巴旗下的阿里云RDS团队正式加入WebScaleSQL.WebScaleSQL是Facebook. Google.Twitter和Linkedin四家公司的MySQL团队发起的MySQL开源组织,旨在改进MySQL在规模和性能等方面的问题.阿里云RDS团队有专门的源码小组负责MySQL源码级别的改进,他们也经常活跃在MySQL社区中,此次受邀加入WebScaleSQL组织也是对他们工作的肯定和认可.近日,InfoQ编辑采访了RDS团队的负责人褚霸,

阿里云RDS受邀加入WebScaleSQL 成全球第五家公司成员

2015年1月,阿里巴巴旗下的阿里云RDS团队正式受邀加入WebScaleSQL.这是WebScaleSQL第一次邀请中国团队加入其中, 阿里云 RDS团队也将作为全球第五家公司成员,与Facebook, Google, Twitter和Linkedin这样的世界顶级团队并肩一起改进MySQL. WebScaleSQL (http://webscalesql.org/)是Facebook, Google, Twitter和Linkedin四家公司的MySQL团队发起的MySQL开源组织,旨在改进

[SQL]阿里云RDS设置MSSQL恢复模式为“简单”

-- 取消数据库镜像ALTER DATABASE <database_name> SET PARTNER OFF-- 设置数据库镜像RESTORE DATABASE <database_name> WITH RECOVERY-- 设置恢复模式为简单alter database <database_name> set recovery simple   [SQL]阿里云RDS设置MSSQL恢复模式为"简单"

重磅干货免费下载!阿里云RDS团队论文被数据库顶会SIGMOD 2018收录

ACM SIGMOD数据管理国际会议是由美国计算机协会(ACM) 数据管理专业委员会(SIGMOD)发起.在数据库领域具有最高学术地位的国际性学术会议. SIGMOD和另外两大数据库会议VLDB.ICDE构成了数据库领域的三个顶级会议.相对而言,SIGMOD比另外两个会议的含金量更高,被录取的难度更大.ACM SIGMOD的论文录取率是很低的,平均录取率大约仅为15%-17%. 来自阿里云RDS团队的论文"TcpRT: Instrument and Diagnostic Analysis Sys