我需要通过Ansible在不同的区域创建一个只读副本。
docs似乎没有提及这是否可行。他们只提到正常的只读副本:
#input dimension
r <- 10
c <- 3
#input matrices
dt <- matrix(runif(r*c),r,c)
wt <- matrix(c(1,0,0,0,2,0,0,0,1),3,3) #weights
#column controller
c.limit <- c(60,50,70)
#create structure for lpSolve
ncol <- r*c
lp.create <- make.lp(ncol=ncol)
set.type(lp.create, columns=1:ncol, type = c("binary"))
#create objective values
obj.vals <- as.vector(t(dt%*%wt))
set.objfn(lp.create, obj.vals)
lp.control(lp.create,sense='max')
#Add constraints to ensure sum of parameters for every row (rowSum) <= 1
for (i in 1:r){
add.constraint(lp.create, xt=c(1,1,1),
indices=c(3*i-2,3*i-1,3*i), rhs=1, type="<=")
}
#Add constraints to ensure sum of parameters for every column (colSum) <= column limit (defined above)
for (i in 1:c){
add.constraint(lp.create, xt=rep(1,r),
indices=seq(i,ncol,by=c), rhs=c.limit[i], type="<=")
}
#Add constraints to ensure sum of column objective (t((dt%*%wt)[,i])%*%P[,i) <= limits defined in the problem)
#NOT SURE HOW TO APPLY A CONSTRAINT THAT IS DEPENDENT ON THE OBJECTIVE FUNCTION
solve(lp.create)
get.objective(lp.create) #20
final.par <- matrix(get.variables(lp.create), ncol = c, byrow=T) # Reshape
答案 0 :(得分:2)
创建跨区域副本时,它与创建普通只读副本的工作方式完全相同,只是不必指定实例标识符,而是必须指定完整的ARN。这意味着如果您在帐户my-mysql-instance
中的US East 1中有一个名为123456789012
的源实例,那么您的ARN(以及RDS模块的instance_name
参数)将如下所示:
arn:aws:rds:us-east-1:123456789012:db:my-mysql-instance
所以你只需要调整文档中的复制任务就可以了:
- rds:
command: replicate
region: eu-west-1
instance_name: new-database-replica
source_instance: arn:aws:rds:us-east-1:123456789012:db:my-mysql-instance
wait: yes
wait_timeout: 600
这将在位于US West 1的名为new-database-replica
的源数据库实例中,在EU West 1(爱尔兰)中创建一个名为my-mysql-instance
的新只读副本。