Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS service discovery integration #1497

Open
morgo opened this issue Apr 4, 2019 · 3 comments
Open

AWS service discovery integration #1497

morgo opened this issue Apr 4, 2019 · 3 comments
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@morgo
Copy link

morgo commented Apr 4, 2019

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

AWS is the largest public cloud, but the Kubernetes support is still immature (and costs $$$ for a small install).

It would be nice to have pd/tidb/tikv integrate with Route53's service discovery out of the box. This can be done with the AWS GO SDK.

  1. What did you expect to see?

It would be nice to be able to do something like this (for first run):

./bin/pd-server \
 --name=pd1 \
 --data-dir=pd \
 --aws-bootstrap
Created new Route53 Service "srv-iy3d7hhlf5cjciph".

And then for subsequent:

./bin/pd-server \
 --name=pd1 \
 --data-dir=pd \
 --aws-service-id=srv-iy3d7hhlf5cjciph

Then with TiDB and TiKV:

./bin/tidb-server \
--store=tikv \
--aws-service-id=srv-iy3d7hhlf5cjciph

./bin/tikv-server \
--aws-service-id=srv-iy3d7hhlf5cjciph \
 --data-dir=tikv
  1. What did you see instead?

Instead it requires complex shell scripting because of the multiple commands:

aws servicediscovery create-private-dns-namespace --vpc vpc-b9ed28c2 --name tidb.local
(capture the output of the operation id)
(check to get the namespace id from an api command using the operation-id, waiting in a loop)
aws servicediscovery create-service --name pd --namespace-id <value-here>

INTERNALIP=`curl http://169.254.169.254/latest/meta-data/local-ipv4`
INSTANCEID=`curl http://169.254.169.254/latest/meta-data/instance-id`

screen -dm ./pd-master-linux-amd64/bin/pd-server \
 --name=pd1 \
 --data-dir=pd \
 --client-urls="http://$INTERNALIP:2379" \
 --peer-urls="http://$INTERNALIP:2380" \
 --initial-cluster="pd1=http://$INTERNALIP:2380" \
 --log-file=pd.log

aws servicediscovery register-instance --service-id srv-iy3d7hhlf5cjciph --instance-id $INSTANCEID --attributes=AWS_INSTANCE_IPV4=$INTERNALIP
  1. What version of PD are you using (pd-server -V)?
@morgo morgo added the type/enhancement The issue or PR belongs to an enhancement. label Apr 4, 2019
@gregwebs
Copy link
Contributor

gregwebs commented Apr 5, 2019

I think PD should definitely facilitate bootstrap more, but not necessarily in a cloud specific way. Its nice to try to keep pd dependencies light and not ship a dependency on every cloud vendor. Maybe part of this could be a cloud provider neutral enhancement and part shell script? I think the shell script is doable, I am used to writing those for AWS and could help with that.

I already have a suggestion for getting rid of the TIKV advertise-addr argument:
tikv/tikv#4447

@morgo
Copy link
Author

morgo commented Apr 5, 2019

I think the shell script is doable, I am used to writing those for AWS and could help with that.

I would prefer either built-in, or another go binary. Shell scripts are hard to make portable since only the language (bash) is constant. All the programs can vary. Some time back MySQL switched from using shell and perl scripts to only C++ binaries, and it's made installation smoother.

@gregwebs
Copy link
Contributor

gregwebs commented Apr 5, 2019

Its true that the aws cli for example does make breaking changes. I agree it is nice to have shell script at the most just download the actual programs that have well-specified dependencies. But they are good for prototyping solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants