Service Broker Usage?

486 views
Skip to first unread message

玲 丁

unread,
Jul 4, 2012, 4:05:13 AM7/4/12
to vcap-dev
Hi all,

The service_broker_cli tool is considered to accelarate users to
access service broker, I dont know how to use it to config my own
database service. Is there any references?

Thanks,
Linna

Chunjie Zhu

unread,
Jul 4, 2012, 6:46:00 AM7/4/12
to vcap...@cloudfoundry.org
The service_broker_cli configuration file, https://github.com/cloudfoundry/vcap-services/blob/master/tools/service_broker_cli/config/services.yml
---
service_broker: http://service-broker1.vcap.me  <- service broker host URL
token: "abcd1234"                                               <- key to communication with cloud_controller
service:
  name: broker1
  description: simple test key-value app
  version: "1.0"
  options:
    - name: default
      acls:
        users: [bro...@vmware.com]                     <- user authentication during connecting to external service host
        wildcards: []
      credentials:
        url: http://broker1.external.com                   <- external service host URL

NOTE: Make sure cloud_controller is able to resolve "http://broker1.external.com" to be correct ip address. It's more convenient to register the external service host URL to CF router component. There is a tool which is helpful, see https://github.com/cloudfoundry/vcap-tools/tree/master/router_registrar, the router_registrar configuration file,
---
logging:
  level: info
mbus: nats://localhost:4222                            <- nats connection string
uri: test.vcap.me                                             <- external service host URL
host: localhost                                                <- external service host real ip address
port: 80                                                           <- external service listen port
tags:
  foo: bar

The cloud_controller configuration file, https://github.com/cloudfoundry/cloud_controller/blob/master/cloud_controller/config/cloud_controller.yml
service_broker:
  token: ["abcd1234"]                                          <- key to communication with service broker host, same with the above

Last but not least, make sure your network settings and firewall settings are really correct.

Regard,
Chunjie


From: "玲 丁" <linnad...@gmail.com>
To: "vcap-dev" <vcap...@cloudfoundry.org>
Sent: Wednesday, July 4, 2012 4:05:13 PM
Subject: [vcap-dev] Service Broker Usage?

Nicholas Kushmerick

unread,
Jul 6, 2012, 1:46:27 PM7/6/12
to vcap...@cloudfoundry.org
Let me just make one remark  on Chunjie's explanation:

     credentials:
        url: http://broker1.external.com                   <- external service host URL
Note that credentials should contain whatever information is needed by applications to use the service.  In this trivial example, it is just a URL.  But for database, it would probably include username, password, databasename, host, port.  The credentials are opaque to the Service Broker, it (actually DEAs) just pass them along to applications via the usual VCAP_SERVICES environment variable.
--
Nick
phone +1.206.293.5186 · skype nicholaskushmerick

linnad...@gmail.com

unread,
Jul 20, 2012, 4:04:27 AM7/20/12
to vcap...@cloudfoundry.org
 Hi Nick,

Chunjie's explanation was clear that I need to provide the local service URL,to which Cloud Controller can connect.
As you mentioned ablove, the service is a database, wich means I have to provide  parameters like hostname,host,databasename, username, password. Since DEA passes these parameters to VCAP_SERVICES,  and I've tried to specify these params to pre_defined_services.yml in the .../services/service_broker/config directory,
--------------------
service:
name:mysql-broker
description: blah blah
version:"5.1"
options:
  -name:mysql
  acls:
     users:[blah blah]
     credentials:
          name:test
          hostname:myhost
          host:myhost ip address
          port:3306
          user:linna
          username:linna
          password:xxx
  -------------------
  When I restart the service_broker, it reports an error : Couldn't read config file , syntax error  ....'hostname:myhost'.
  The network is ok, and the firewall has be disabled.
  If the method is wrong, then how should I config these params?

  Thanks,
  Linna.

在 2012年7月7日星期六UTC+8上午1时46分27秒,Nicholas Kushmerick写道:

Chunjie Zhu

unread,
Jul 22, 2012, 2:08:53 AM7/22/12
to vcap...@cloudfoundry.org
-> "When I restart the service_broker, it reports an error : Couldn't read config file , syntax error  ....'hostname:myhost'."
How did you restart the service_broker? If you do not give "-c <config file path>" option to service_broker cli, then it will use the default config file. Most likely, the default config file does not work.

Regards,
Chunjie


From: linnad...@gmail.com
To: vcap...@cloudfoundry.org
Sent: Friday, July 20, 2012 4:04:27 PM
Subject: Re: [vcap-dev] Service Broker Usage?

linnad...@gmail.com

unread,
Jul 23, 2012, 4:24:29 AM7/23/12
to vcap...@cloudfoundry.org
Thanks Chunjie,

I 've found the course why it couldn't read configure file. That's because .yml file is sensitive to spaces, and that's silly : )

However, I've got a new problem, and I wish you can help me.

Here's the link: https://groups.google.com/a/cloudfoundry.org/d/topic/vcap-dev/hyyXp_VnuEw/discussion

Great thanks!

Linna


在 2012年7月22日星期日UTC+8下午2时08分53秒,Chunjie Zhu写道:
Reply all
Reply to author
Forward
0 new messages