使用ouchdb的暂存设置 [英] Staging setup with couchdb

查看:78
本文介绍了使用ouchdb的暂存设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行应用程序的生产服务器,该应用程序使用CouchDB作为其主数据库。我想设置一个具有CouchDB实例的登台服务器,我可以始终将其同步回生产实例并获得干净的副本。

I have a production server running an app that uses CouchDB as its main database. I'd like to set up a staging server that has a CouchDB instance that I can always sync back up to the production instance and get a clean copy.

一个幼稚的解决方案仅仅是让登台服务器连续复制生产服务器的数据库,然后使用它即可。当然,问题是在登台服务器上进行测试的过程中,我可能会做一些修改数据库的事情。

A naive solution would be simply to have the staging server continuously replicate the production server's database, and just use that. The problem of course is that in the course of testing on the staging server, I may do things that modify the database.

在功能上正确的方法是删除数据库每次都从生产中复制出来;但是显然,如果我每次都要从头开始,这将花费很长时间。

Functionally correct would be for me to delete the database every time and re-replicate from production; but obviously this would take a reeeeeeaaally long time if I had to start from scratch every time.

我正在寻找以下解决方案:1)保留原始副本临时服务器上的生产db的数据库,它会不断为其视图重新建立索引2)将包括索引的所有db文件复制到名为其他名称的db 3)使用并在完成后将其删除。

I'm looking for a solution something like: 1) Keep a pristine copy of the production db on the staging server, that is constantly reindexing its views 2) copy all the db files including the indexes to a db named something else 3) use that and blow it away when done.

有没有人尝试过类似的操作,并且复制db文件并重命名它们甚至可以顺利进行吗?如果是,则复制哪些文件并且不需要复制这些文件? p>

Has anyone ever tried something like this and Does copying db files and renaming them even work smoothly? If so, what files do and don't need to be copied?

推荐答案

您所建议的方法是。将数据库和索引文件复制到新名称即可。

Your approach is what I would recommend. Copying DB and index files to a new name works as expected.

检查 / _ config / couchdb 的值 database_dir view_index_dir 然后

cd $database_dir
cp live_replica.couch local_copy_to_mess_with.couch

cd $view_index_dir # most likely the same dir
cp -r .live_replica_design .local_copy_to_mess_with_design

确保以这些目录中所有其他文件的所有者身份运行这些命令 couchbase ,否则,couchdb将无权使用您创建的文件。您可以使用 ls -alR 检查正确的所有者和组。

Make sure to run these commands as the owner of all the other files in these directories, e.g. couchbase, or else couchdb won't have the permissions to use the files you create. You can check correct owners and groups with ls -alR.

这篇关于使用ouchdb的暂存设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆