加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – 厨师和postgres;我该如何指定密码?

发布时间:2020-12-13 15:57:38 所属栏目:百科 来源:网络整理
导读:我是厨师的新手,我正在尝试解释文档.我已将opscode postgresql配方添加到我的chef-solo环境中. postgresql似乎安装和启动就好了,但不幸的是我无法登录到服务器,使它几乎无法使用. 文档提到了这一点: The following node attribute is stored on the Chef Se
我是厨师的新手,我正在尝试解释文档.我已将opscode postgresql配方添加到我的chef-solo环境中. postgresql似乎安装和启动就好了,但不幸的是我无法登录到服务器,使它几乎无法使用.

文档提到了这一点:

The following node attribute is stored on the Chef Server when using
chef-client. Because chef-solo does not connect to a server or save
the node object at all,to have the password persist across chef-solo
runs,you must specify them in the json_attribs file used. For
Example:

{
  "postgresql": {
    "password": {
      "postgres": "iloverandompasswordsbutthiswilldo"
    }
  },"run_list": ["recipe[postgresql::server]"]
}

但是,我不知道“json_attribs”文件是什么.配方本身不包含这样的文件,我尝试使用谷歌搜索,没有结果.我也尝试创建这样一个文件并将其粘贴在我的目录结构中的随机位置,但当然这不起作用.

并且通过“没有工作”,我的意思是我带来了流浪汉,ssh’ed,并尝试“psql -U postgres -W”,然后输入我创建的密码…但总是得到一个身份验证错误.另请注意,我理解我为密码提供的值(例如,代替上面示例中的“iloverandompasswordsbutthiswilldo”)应该是密码的MD5哈希值,而不是明文,这就是我提供的内容.

解决方法

因为你正在使用Vagrant,你应该在你的Vagrant文??件中添加类似下面的内容到config.vm.provision中:chef_solo do | chef | section(也存在一个或多个chef.add_recipe调用):

config.vm.provision :chef_solo do |chef|
  # other stuff... like: chef.add_recipe "postgresql::server"
  chef.json = {
    "postgresql" => {
      "password" => {
        "postgres" => "iloverandompasswordsbutthiswilldo"
      }
    }
  }
end

chef.json哈希是所有节点特定属性所在的位置,在Vagrant提供的运行期间将其移交给chef-solo,有关详细信息,请参阅Vagrant doc.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读