Mac OSX上的PostgreSQL环境文件? [英] PostgreSQL environment file on Mac OSX?

查看:442
本文介绍了Mac OSX上的PostgreSQL环境文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PostgreSQL似乎有一个允许设置环境变量的环境文件。在Linux上(在我的情况下是Kubuntu 11.10),它位于例如 /etc/postgresql/8.4/main/environment ,默认情况下为空,除了一些有用的评论。



在Mac OSX Lion上,该文件似乎不存在:我希望它在例如 /Library/PostgreSQL/9.0/data / 所有其他配置文件都是,但它不在那里 - 如果我创建它似乎不是



如何在Mac OSX上为PostgreSQL服务器设置环境变量?

解决方案

没有标准的方式来指定PostgreSQL的环境变量,我认为文件是 Kubuntu 具体的。



我做了什么来缓解我的生活是ORACLE使用的复制方法:




  • 我有 / etc我运行PostgreSQL数据库的每个服务器上的/ pgtab 文件;

  • 我指定在 / etc中单行运行的每个集群/ pgtab ;

  • 我已经创建了一个脚本 pgenv 根据 / etc / pgtab 显示集群的菜单(如果有更多只有一个),并初始化所有 PATH s和变量。 / li>


它适用于我的MacB ookPro和所有基于Linux和HP-UX的服务器。


PostgreSQL seems to have an environment file that allows settings environment variables. On Linux (Kubuntu 11.10 in my case), it is located at e.g. /etc/postgresql/8.4/main/environment and empty by default, apart from a few helpful comments.

On Mac OSX Lion, the file does not seem to exist: I would expect it at e.g. /Library/PostgreSQL/9.0/data/ as that's where all the other configuration files are, but it is not there - and if I create it, it does not seem to be used.

How can I set environment variables for the PostgreSQL server on Mac OSX ?

解决方案

There is no standard way to specify environment variables for PostgreSQL, I assume that file is Kubuntu specific.

What I did to ease my life was copying approach used by ORACLE:

  • I have /etc/pgtab file on each server where I run PostgreSQL databases;
  • I specify each cluster I run on a single line in the /etc/pgtab;
  • I've created a script pgenv which based on the /etc/pgtab shows the menu of clusters (in case there're more then just one) and initialize all PATHs and variables.

It works on my MacBookPro and on all Linux and HP-UX based servers.

这篇关于Mac OSX上的PostgreSQL环境文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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