Skip to content

Instantly share code, notes, and snippets.

@rawlingsj
Created September 24, 2014 16:10
Show Gist options
  • Save rawlingsj/f420cf2fd9cc7c6b9b98 to your computer and use it in GitHub Desktop.
Save rawlingsj/f420cf2fd9cc7c6b9b98 to your computer and use it in GitHub Desktop.
How to create a fabric ensemble from CLI
created by James Rawlings on Aug 21, 2014 9:04 AM, last modified by James Rawlings on Aug 21, 2014 9:49 AM Version 4
There are a number of options when creating a fabric ensemble. Below is one way that we have used for many test and production setups. This example will set up a three fabric server ensemble using JBoss Fuse 6.1 and uses vagrant images from fabric8-devops/vagrant at master · fabric8io/fabric8-devops · GitHub and the remote containers Red Hat JBoss Fuse - Console Reference - fabric:container-create-ssh
Make sure all the prerequisites are installed including SSH keys if used for bidirectional SSH between all nodes and fabric ensemble servers and required ports (details in a followup post) - not needed if using the vagrant images above.
sudo yum -y install java-1.7.0-openjdk-devel.x86_64
sudo yum -y install telnet
sudo yum -y install unzip
NOTE: I understand that the dependency on telnet is to be removed.
Always start fuse in the background as if you start it in the foreground you will shutdown one of the ensemble members as soon as you close the session.
1. edit the etc/users.properties and uncomment admin user and modify password to something more secure
admin=fuse,admin
2. edit the etc/system.properties and update the karaf name so we have consistency across our ensemble
karaf.name=fs01
3. Start Fuse in the background
./bin/start
4. wait for process to start and use client to connect with password set in step above
./bin/client -u admin -p fuse
5. Create a new user to build the fabric with, this means we can remove the user we created in the user.properties later to make things a bit more secure.
JBossFuse:karaf@fs01> esb:create-admin-user --new-user fabric --new-user-password fabric
6. Create a fabric specifying a resolver that suits, the localip is useful when testing this out on say the Vagrant images. Providing the fabric profile prevents the default jboss-fuse-full profile being added which includes that pesky default broker.
JBossFuse:karaf@fs01> fabric:create --wait-for-provisioning --global-resolver localip --zookeeper-password fabric --profile fabric
7. Delete the admin user that we uncommented in users.properties as we will use the fabric user created above when connecting in the future. This password is stored in Git rather than the file system.
JBossFuse:admin@fs01> jaas:manage --realm karaf --module io.fabric8.jaas.ZookeeperLoginModule
JBossFuse:admin@fs01> userdel admin
JBossFuse:admin@fs01> jaas:update
JBossFuse:admin@fs01> exit
7. Create two remote containers with the fabric profile (so we have the correct fabric commands to use later if needed)
./bin/client -u fabric -p fabric
JBossFuse:karaf@fs01> fabric:container-create-ssh --host integration1 --user root --password vagrant --path=/opt/rh --profile=fabric fs02
JBossFuse:karaf@fs01> fabric:container-create-ssh --host integration2 --user root --password vagrant --path=/opt/rh --profile=fabric fs03
8. Wait until remote containers are provisioned with the fabric profile
JBossFuse:karaf@fs01> watch container-list
9. Add the two new containers to the ensemble. This actually creates a brand new ensemble of three rather than the original one. Remember that you need to add and remove two containers at a time to ensure you don't create a split brain scenario.
JBossFuse:fabric@fs01> ensemble-add fs02 fs03
Doing a container list should present you with the new ensemble profile applied to all containers
JBossFuse:fabric@fs01> container-list
[id] [version] [connected] [profiles] [provision status]
fs01* 1.0 true fabric, fabric, fabric-ensemble-0001-1 success
fs02 1.0 true fabric, fabric-ensemble-0001-2 success
fs03 1.0 true fabric, fabric-ensemble-0001-3 success
@abcabc6
Copy link

abcabc6 commented Apr 23, 2015

Hi James,

Thanks for your help.

I have a question, before doing "fabric:container-create-ssh...fs02" should I start up Fuse instance on machine "integration1"?
What is the difference between this approach and doing "fabric:join ..." on machine "integration1"?

Best Regards,
Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment