|
| 1 | +# kinesis-cli |
| 2 | + |
| 3 | +kinesis-cli is a tool for interacting with kinesis from the command line. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +You can either install the kinesis-cli using `go get` or `go install`: |
| 8 | +(TODO: verify this works) |
| 9 | + |
| 10 | + $ go install github.com/sendgridlabs/go-kinesis/kinesis-cli |
| 11 | + |
| 12 | +or build it and run it from the kinesis-cli folder: |
| 13 | + |
| 14 | +``` |
| 15 | +$ go get github.com/sendgridlabs/go-kinesis/kinesis-cli |
| 16 | +$ cd $GOPATH/src/github.com/sendgridlabs/go-kinesis/kinesis-cli |
| 17 | +$ go build |
| 18 | +$ ./kinesis-cli |
| 19 | +Usage: ./kinesis-cli <command> [<arg>, ...] |
| 20 | +(Note: expects $AWS_ACCESS_KEY and $AWS_SECRET_KEY to be set) |
| 21 | +Commands: |
| 22 | + create <streamName> [<numShards>] |
| 23 | + delete <streamName> |
| 24 | + describe <streamName> [<startShardId> <limit>] |
| 25 | + split <streamName> <shardId> [<hash>] |
| 26 | + merge <streamName> <shardId> <adjacentShardId> |
| 27 | +``` |
| 28 | + |
| 29 | +Note that you'll need to store your access/secret key in the proper env vars: |
| 30 | + |
| 31 | + $ export AWS_ACCESS_KEY=123myaccesskey456; export AWS_SECRET_KEY=789myVerySecretKey432 |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +For all commands except `describe`, you will be prompted for confirmation before the aws request is sent. |
| 36 | + |
| 37 | +##### Create a new stream: (only a single shard is created if num shards is not specified) |
| 38 | + |
| 39 | + $ ./kinesis-cli create somestream 2 |
| 40 | + |
| 41 | +##### Delete an existing stream: |
| 42 | + |
| 43 | + $ ./kinesis-cli delete somestream |
| 44 | + |
| 45 | +##### Describe a stream: |
| 46 | + |
| 47 | +``` |
| 48 | +$ ./kinesis-cli describe somestream |
| 49 | +{ |
| 50 | + "StreamDescription": { |
| 51 | + "HasMoreShards": false, |
| 52 | + "Shards": [ |
| 53 | + { |
| 54 | + "AdjacentParentShardId": "", |
| 55 | + "HashKeyRange": { |
| 56 | + "EndingHashKey": "170141183460469231731687303715884105727", |
| 57 | + "StartingHashKey": "0" |
| 58 | + }, |
| 59 | + "ParentShardId": "", |
| 60 | + "SequenceNumberRange": { |
| 61 | + "EndingSequenceNumber": "", |
| 62 | + "StartingSequenceNumber": "49540491727041816751370913972624375777284624614827229185" |
| 63 | + }, |
| 64 | + "ShardId": "shardId-000000000000" |
| 65 | + }, |
| 66 | + { |
| 67 | + "AdjacentParentShardId": "", |
| 68 | + "HashKeyRange": { |
| 69 | + "EndingHashKey": "340282366920938463463374607431768211455", |
| 70 | + "StartingHashKey": "170141183460469231731687303715884105728" |
| 71 | + }, |
| 72 | + "ParentShardId": "", |
| 73 | + "SequenceNumberRange": { |
| 74 | + "EndingSequenceNumber": "", |
| 75 | + "StartingSequenceNumber": "49540491727064117496569444595765911495557272976333209617" |
| 76 | + }, |
| 77 | + "ShardId": "shardId-000000000001" |
| 78 | + } |
| 79 | + ], |
| 80 | + "StreamARN": "arn:aws:kinesis:us-east-1:123456789:stream/somestream", |
| 81 | + "StreamName": "somestream", |
| 82 | + "StreamStatus": "ACTIVE" |
| 83 | + } |
| 84 | +} |
| 85 | +
|
| 86 | +``` |
| 87 | + |
| 88 | +##### Split a shard: (it will suggest a new hash key that evenly splits the shard) |
| 89 | + |
| 90 | +``` |
| 91 | +$ ./kinesis-cli split somestream shardId-000000000000 |
| 92 | +Shard's current hash key range (0 - 170141183460469231731687303715884105727) |
| 93 | +Default (even split) key: 85070591730234615865843651857942052863 |
| 94 | +Type new key or press [enter] to choose default: |
| 95 | +Are you sure you want to split shard shardId-000000000000 at hash key 85070591730234615865843651857942052863? |
| 96 | +(y/N): y |
| 97 | +``` |
| 98 | + |
| 99 | +##### Merge two adjacent shards: (must be specified in low->high order) |
| 100 | + |
| 101 | + $ go build && ./kinesis-cli merge somestream shardId-000000000003 shardId-000000000001 |
0 commit comments