Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Start etcd daemon upon starting of glusterd daemon #65

Merged
merged 13 commits into from
Jan 20, 2016

Conversation

gaurav36
Copy link
Member

@gaurav36 gaurav36 commented Jan 5, 2016

Currently with starting of glusterd daemon etcd is not starting.
For bootstrapping of etcd first basic requirement is to run etcd
daemon on every node.

With this patch it will start etcd daemon upon starting of
glusterd daemon.

Issue #64

Signed-off-by: Gaurav Kumar Garg garg.gaurav52@gmail.com

Currently with starting of glusterd daemon etcd is not starting.
For bootstrapping of etcd first basic requirement is to run etcd
daemon on every node.

With this patch it will start etcd daemon upon starting of
glusterd daemon.

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
@@ -41,4 +42,12 @@ func main() {
if err != nil {
log.Fatal("Could not start GlusterD Rest Server. Aborting.")
}

// Starting etcd daemon upon starting of GlusterD
etcd_start := exec.Command("/bin/etcd")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested these changes? I don't think etcd instance will come up here. OTOH, we'd need to pass some additional parameters to start etcd. Refer to etcd documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested this change only in sample programme. this is not my final change. will add some parameter in new PR.

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
@@ -0,0 +1,36 @@
package context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this needs to be in context package? You could have a separate package called etcd-mgmt and then have bootstrap.go.

@atinmu
Copy link
Contributor

atinmu commented Jan 8, 2016

We'd also need to stop the etcd daemon on glusterd shutdown.

Resolving previous commit comment

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
@atinmu
Copy link
Contributor

atinmu commented Jan 11, 2016

I'd also like to see unit test coverage for this.

Resolving previous commit comment

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
Resolving previous commit comment

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
return err
}

HostPort2379 := "http://" + hostname + ":2379"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not start names with caps unnecessarily until and unless they are exposed to other packages. Also I'd like to see a better name here. There is no harm of assigning same value to multiple variables. listenClientUrils, advClientUrls would be better for the sake of better code readability

@atinmu
Copy link
Contributor

atinmu commented Jan 12, 2016

You'd also need to merge the master and repush the changes as this branch indicates a conflict with the master

@atinmu
Copy link
Contributor

atinmu commented Jan 12, 2016

@gaurav36 : Also add test for etcdmgmt package

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
Resolving previous commit comment

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>

advClientUrls := "http://" + hostname + ":2380"

etcdStart := exec.Command("/bin/etcd",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/etcdStart/etcdCommand

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are starting etcd it self. If we are executing any etcd command then we should have etcdCommand here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaurav36 : etcdCommand interprets what command string you have formed for the etcd instance to bring up. If you look at the signature of exec.Command it returns a command structure. Check other projects if you wish, mostly they use 'cmd' for the return value.

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
for {

// Waiting for 15 second. Within 15 second health of etcd should
// be true otherwise it should through an error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/through/throw

@atinmu
Copy link
Contributor

atinmu commented Jan 14, 2016

@gaurav36 : rest of the things look good to me.
@kshlm : Do you want to have a look at it?

Resolving previous commit comment

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
In previous commit adding log in better way

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>

initialAdvPeerUrls := "http://" + hostname + ":2380"

etcdStart := exec.Command("/bin/etcd",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would fail in systems where etcd is not installed. This has to be taken care in install-req.sh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created separate issue #70 for this. PR #71 will address this comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use '/bin/etcd'. use etcd instead as the the executable should be picked up from $GOPATH

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, in latest PR

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
Minor change in previous commit.

Issue gluster#64

Signed-off-by: Gaurav Kumar Garg <garg.gaurav52@gmail.com>
atinmu pushed a commit that referenced this pull request Jan 20, 2016
Start etcd daemon upon starting of glusterd daemon
@atinmu atinmu merged commit 678448a into gluster:master Jan 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants