RelStorage is a storage implementation for ZODB that stores pickles in
a relational database. PostgreSQL 8.1 and above (via psycopg2), MySQL
5.0.32+ / 5.1.34+ (via MySQLdb 1.2.2 and above), and Oracle 10g and 11g
(via cx_Oracle) are currently supported. RelStorage replaced the
PGStorage project.
.. contents::
Features
========
* It is a drop-in replacement for FileStorage and ZEO.
* There is a simple way to convert FileStorage to RelStorage and back again.
You can also convert a RelStorage instance to a different relational database.
* Designed for high volume sites: multiple ZODB instances can share the same
database. This is similar to ZEO, but RelStorage does not require ZEO.
* According to some tests, RelStorage handles high concurrency better than
the standard combination of ZEO and FileStorage.
* Whereas FileStorage takes longer to start as the database grows due to an
in-memory index of all objects, RelStorage starts quickly regardless of
database size.
* Supports undo, packing, and filesystem-based ZODB blobs.
* Both history-preserving and history-free storage are available.
* Capable of failover to replicated SQL databases.
* Free, open source (ZPL 2.1)
Installation
============
You can install RelStorage using easy_install::
easy_install RelStorage
RelStorage requires a version of ZODB that is aware of MVCC storages.
ZODB 3.9 supports RelStorage without any patches. ZODB 3.7 and 3.8 can
support RelStorage if you first apply a patch to ZODB. You can get
versions of ZODB with the patch already applied here:
http://packages.willowrise.org
The patches are also included in the source distribution of RelStorage.
You need the Python database adapter that corresponds with your database.
Install psycopg2, MySQLdb 1.2.2+, or cx_Oracle 4.3+.
**CAUTION**: RelStorage 1.6 will *not* work with ZODB 5 or ZEO 5. You
will need a 4.x or older version of those two dependencies. The
setup.py distributed with RelStorage cannot enforce this due to the
legacy nature of its ZODB3 dependency.
Configuring Your Database
-------------------------
You need to configure a database and user account for RelStorage.
RelStorage will populate the database with its schema the first time it
connects.
PostgreSQL
~~~~~~~~~~
If you installed PostgreSQL from a binary package, you probably have a
user account named ``postgres``. Since PostgreSQL respects the name of
the logged-in user by default, switch to the ``postgres`` account to
create the RelStorage user and database. Even ``root`` does not have
the PostgreSQL privileges that the ``postgres`` account has. For
example::
$ sudo su - postgres
$ createuser --pwprompt zodbuser
$ createdb -O zodbuser zodb
New PostgreSQL accounts often require modifications to ``pg_hba.conf``,
which contains host-based access control rules. The location of
``pg_hba.conf`` varies, but ``/etc/postgresql/8.4/main/pg_hba.conf`` is
common. PostgreSQL processes the rules in order, so add new rules
before the default rules rather than after. Here is a sample rule that
allows only local connections by ``zodbuser`` to the ``zodb``
database::
local zodb zodbuser md5
PostgreSQL re-reads ``pg_hba.conf`` when you ask it to reload its
configuration file::
/etc/init.d/postgresql reload
MySQL
~~~~~
Use the ``mysql`` utility to create the database and user account. Note
that the ``-p`` option is usually required. You must use the ``-p``
option if the account you are accessing requires a password, but you
should not use the ``-p`` option if the account you are accessing does
not require a password. If you do not provide the ``-p`` option, yet
the account requires a password, the ``mysql`` utility will not prompt
for a password and will fail to authenticate.
Most users can start the ``mysql`` utility with the following shell
command, using any login account::
$ mysql -u root -p
Here are some sample SQL statements for creating the user and database::
CREATE USER 'zodbuser'@'localhost' IDENTIFIED BY 'mypassword';
CREATE DATABASE zodb;
GRANT ALL ON zodb.* TO 'zodbuser'@'localhost';
FLUSH PRIVILEGES;
Oracle
~~~~~~
Initial setup will require ``SYS`` privileges. Using Oracle 10g XE, you
can start a ``SYS`` session with the following shell commands::
$ su - oracle
$ sqlplus / as sysdba
You need to create a database user and grant execute privileges on
the DBMS_LOCK package to that user.
Here are some sample SQL statements for creating the database user
and granting the required permissions::
CREATE USER zodb IDENTIFIED BY mypassword;
GRANT CONNECT, RESOURCE, CREATE TABLE, CREATE SEQUENCE TO zodb;
GRANT EXECUTE ON DBMS_LOCK TO zodb;
Configuring Plone
-----------------
To install RelStorage in Plone, see the instructions in the following
article:
http://shane.willowrise.com/archives/how-to-install-plone-with-relstorage-and-mysql/
Plone uses the ``plone.recipe.zope2instance`` Buildout recipe to
generate zope.conf, so the easiest way to configure RelStorage in a
Plone site is to set the ``rel-storage`` parameter in ``buildout.cfg``.
The ``rel-storage`` parameter contains options separated by newlines,
with these values:
* ``type``: any database type supported (``postgresql``, ``mysql``,
or ``oracle``)
* RelStorage options like ``cache-servers`` and ``poll-interval``
* Adapter-specific options
An example::
rel-storage =
type mysql
db plone
user plone
passwd PASSWORD
Configuring Zope 2
------------------
To integrate RelStorage in Zope 2, specify a RelStorage backend in
``etc/zope.conf``. Remove the main mount point and add one of the
following blocks. For PostgreSQL::
%import relstorage
<zodb_db main>
mount-point /
<relstorage>
<postgresql>
# The dsn is optional, as are each of the parameters in the dsn.
dsn dbname='zodb' user='username' host='localhost' password='pass'
</postgresql>
</relstorage>
</zodb_db>
For MySQL::
%import relstorage
<zodb_db main>
mount-point /
<relstorage>
<mysql>
# Most of the options provided by MySQLdb are available.
# See component.xml.
db zodb
</mysql>
</relstorage>
</zodb_db>
For Oracle (10g XE in this example)::
%import relstorage
<zodb_db main>
mount-point /
<relstorage>
<oracle>
user username
password pass
dsn XE
</oracle>
</relstorage>
</zodb_db>
To add ZODB blob support, provide a blob-dir option that specifies
where to store the blobs. For example::
%import relstorage
<zodb_db main>
mount-point /
<relstorage>
blob-dir ./blobs
<postgresql>
dsn dbname='zodb' user='username' host='localhost' password='pass'
</postgresql>
</relstorage>
</zodb_db>
Configuring ``repoze.zodbconn``
-------------------------------
To use RelStorage with ``repoze.zodbconn``, a package that makes ZODB
available to WSGI applications, create a configuration file with
contents similar to the following::
%import relstorage
<zodb main>
<relstorage>
<mysql>
db zodb
</mysql>
</relstorage>
cache-size 100000
</zodb>
``repoze.zodbconn`` expects a ZODB URI. Use a URI of the form
``zconfig://path/to/configuration#main``.
Included Utilities
==================
``zodbconvert``
---------------
RelStorage comes with a script named ``zodbconvert`` that converts
databases between formats. Use it to convert a FileStorage instance to
RelStorage and back, or to convert between different kinds of
RelStorage instances, or to convert other kinds of storages that
support the storage iterator protocol.
When converting between two history-preserving databases (note that
FileStorage uses a history-preserving format), ``zodbconvert``
preserves all objects and transacti
没有合适的资源?快使用搜索试试~ 我知道了~
PyPI 官网下载 | RelStorage-1.6.3.tar.gz
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 56 浏览量
2022-01-15
20:13:12
上传
评论
收藏 224KB GZ 举报
温馨提示
共114个文件
py:61个
txt:25个
cfg:5个
资源来自pypi官网。 资源全名:RelStorage-1.6.3.tar.gz
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | RelStorage-1.6.3.tar.gz (114个子文件)
buildout.cfg 4KB
buildout.cfg 2KB
buildout.cfg 722B
setup.cfg 59B
buildout-oracle.cfg 52B
replicas.conf 193B
ro_replicas.conf 49B
replicas.conf 46B
.coveragerc 628B
my.cnf.in 2KB
MANIFEST.in 455B
tox.ini 326B
not-zip-safe 1B
notes 314B
notes 210B
shootout.ods 25KB
pack_policy.ods 20KB
poll-invalidation-zodb-3-8.patch 4KB
poll-invalidation-zodb-3-7.patch 4KB
mysql-no-read-etc.patch 393B
PKG-INFO 59KB
PKG-INFO 59KB
.project 368B
storage.py 55KB
packundo.py 44KB
mover.py 44KB
schema.py 40KB
cache.py 30KB
reltestbase.py 29KB
test_cache.py 23KB
testblob.py 19KB
blobhelper.py 16KB
test_blobhelper.py 14KB
interfaces.py 14KB
oracle.py 14KB
RecoveryStorage.py 13KB
hftestbase.py 11KB
test_batch.py 10KB
mysql.py 9KB
postgresql.py 9KB
testpostgresql.py 9KB
hptestbase.py 9KB
testmysql.py 8KB
testoracle.py 8KB
dbiter.py 8KB
locker.py 8KB
batch.py 7KB
test_zodburi.py 7KB
poller.py 6KB
txncontrol.py 6KB
zodburi_resolver.py 6KB
zodbconvert.py 6KB
treemark.py 5KB
scriptrunner.py 5KB
test_replica.py 5KB
connmanager.py 5KB
test_zodbconvert.py 5KB
oidallocator.py 4KB
replica.py 4KB
test_connmanager.py 3KB
setup.py 3KB
test_zodbpack.py 3KB
stats.py 3KB
options.py 3KB
alltests.py 3KB
zodbpack.py 3KB
pylibmc_wrapper.py 3KB
test_autotemp.py 2KB
config.py 2KB
__init__.py 2KB
test_treemark.py 2KB
packstresstest.py 2KB
util.py 2KB
bootstrap.py 2KB
autotemp.py 2KB
fakecache.py 1KB
bigmark.py 1KB
bigpack.py 1004B
quicktest.py 584B
iter.py 490B
__init__.py 144B
__init__.py 34B
__init__.py 31B
__init__.py 1B
setup-mysql.sh 696B
setup-postgres.sh 423B
migrate.sql 1KB
blob_cache.test 5KB
README.txt 32KB
CHANGES.txt 16KB
blob_transaction.txt 10KB
HISTORY.txt 9KB
blob_packing_history_free.txt 4KB
blob_packing.txt 4KB
migrate-to-1.5.txt 3KB
SOURCES.txt 3KB
caching.txt 3KB
README.txt 3KB
blob_connection.txt 3KB
migrate-to-1.1.txt 3KB
共 114 条
- 1
- 2
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功