便携式PostgreSQL,用于从USB驱动器上进行开发

20
为了在家里进行开发工作,我需要能够运行PostgreSQL数据库。我不想在家里的机器上安装任何东西,所有的东西都应该从USB驱动器中运行。那么如何获取可移植的PostgreSQL?是否可能呢?你在USB驱动器上携带哪些开发工具?这个问题涵盖了几乎所有其他内容,但我还没有找到一个指南来获取可移植的PostgreSQL。如果有可能的话,似乎并不容易。编辑:PostgreSQL Portable可以用。它在我的USB驱动器上非常慢,但是它可以用。我不能推荐长期使用它进行开发,但对于我所需要的来说非常好。也许如果我拿到一个全速的外部驱动器,我会尝试虚拟化。考虑到仅仅从这个驱动器上运行数据库的性能很差,一个完整的虚拟操作系统从中运行将无法使用。

首先,我知道这个问题很老(尽管上次编辑是去年)。无论如何,我只想补充一点,就是在运行PostgreSQL时不应该将数据库文件保留在USB闪存中,这不是由于性能问题,而是因为这最终会烧毁内存。 USB闪存具有每个物理内存块可以重写的固有限制。为了使其更持久,将DB文件复制(不要移动,因为移动会导致写入)到HDD上,运行Postgre,完成后将DB文件移动/复制回USB。此外,在HDD上时最好将DB加密。 - Cyberknight
5个回答

8

6
另一种选择是使用类似于VirtualBox这样的工具,在其中安装您的开发环境(数据库等)。

3

2014年有两个项目可以尝试:http://sourceforge.net/projects/pgsqlportable/http://sourceforge.net/projects/postgresqlportable/?source=recommended

我不能保证第二个,但我正在使用第一个,它可以直接使用。

使用7-zip(http://www.7-zip.org/download.html)解压缩后:

1) Run "start service without usuario.bat" ( english translation )
2) Then run "pgadmin3.bat"

我唯一的小问题是它是用西班牙语编写的。但是我已经通过遵循更改PostgreSQL中系统和错误消息的语言将语言更改为英语。使用谷歌翻译,指令如下:

Description

This is a zip to automatically run postgresql 9.1.0.1 for windows. This version already has pgagent and pldebugger. To run must: 1) unzip the zip 2) run the "start service without usuario.bat" found in the pgsql directory within the folder you just unzipped. 3) Optional. If you want to run the agent works postgresql (pgagent) should only run the "start pgagent.bat" found in the pgsql directory inside the folder you just unzipped. 4) Optional. To manage and / or develop the bd you can run the pgadmin3.bat 5 files) Optional. To stop and / or restart the server correctly use file "service without stopping usuario.bat" usuario.bat or restart service without depending on the case.

Now option for Linux (file. Tar.gz). Postgresql portable Linux 9.2    

Please use the tickets for your answer bugs.    

Username: postgres Password: 123
只是一点提示:在新电脑上,要让pgadminIII工作,您可能需要添加一个数据库。设置在附加的截图中。
希望能有所帮助。

enter image description here


2

1.下载并解压缩:zip 版本

2.在 pgsql 文件夹内创建 data 文件夹(随便取名,我使用了“data”)

3.初始化 data 文件夹:c:\pgsql\bin\initdb.exe -D c:\pgsql\data -U postgres -W -E UTF8 -A scram-sha-256

4.要启动/停止,请参见下一条命令代码(按任意键停止)

c:\pgsql\bin\pg_ctl.exe -D c:\pgsql\data  -l logfile start
pause
c:\pgsql\bin\pg_ctl.exe -D c:\pgsql\data stop

更多信息


1

我同意虚拟化解决方案,但也许你会发现这个链接来自便携式免费软件集合很有用,我已经在本地使用过它,尽管没有从USB上使用。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接