Asim Aslam
59a3e7d4f4
Use etcd serializable option
2019-10-10 19:16:31 +01:00
Asim Aslam
e9dcff49e0
Support listing full service info in etcd
2019-10-07 16:11:52 +01:00
Asim Aslam
2c00e726b6
Decode and hash the existing node
2019-10-06 13:43:41 +01:00
Asim Aslam
2fb2d7145e
Fix etcd registry lease processing and suppression
2019-10-06 09:54:26 +01:00
Asim Aslam
6fe9f2a958
Merge pull request #815 from micro/broker
...
Add broker service implementation
2019-10-04 17:23:29 +01:00
Asim Aslam
cfb846ee7e
Fix race in cache
2019-10-04 16:40:21 +01:00
Asim Aslam
c4b6d0f3a8
fix major deadlock in registry cache
2019-10-04 16:29:56 +01:00
Milos Gajdos
b8815dff14
Append a port to address if it does not exist
2019-10-03 16:16:25 +01:00
Asim Aslam
8d2b12258f
Remove gossip registry
2019-10-03 09:29:48 +01:00
Asim Aslam
31026da2a1
Update etcd.go
...
Use /micro/registry as the etcd key prefix
2019-10-02 20:33:59 +01:00
Milos Gajdos
25148af44c
First commit to add etcd registry support
2019-10-02 18:56:53 +01:00
Asim Aslam
5d77ce9e9b
Rename rcache file to cache
2019-10-02 12:35:20 +01:00
b722798caa
some spelling fixes in memory and gossip registry
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-10-02 03:54:04 +03:00
Milos Gajdos
4b73ac9dc5
Simplified code. Small bug fix the used to lead to multi-registry loop.
2019-09-30 12:48:59 +01:00
Milos Gajdos
3f3f1272b3
Turn regular logs to Debug logs; annotate with Registry "tag"
2019-09-30 12:48:59 +01:00
Milos Gajdos
859ecb1872
Dont set default TTL. Stop tracking nodes with no TTL
2019-09-30 12:48:59 +01:00
Milos Gajdos
204c7d1fcf
Fixed options bug and proto indenting
2019-09-30 12:48:59 +01:00
Milos Gajdos
8417361bce
Set registry TTL to seconds, not the nanoseconds
2019-09-30 12:48:59 +01:00
Milos Gajdos
d85ca7abd2
Set registry TTL properly via protobuf Options
2019-09-30 12:48:59 +01:00
Milos Gajdos
e973bfaa25
Add TTL options to memory registry.
2019-09-30 12:48:59 +01:00
Milos Gajdos
27bd9581bf
Refresh TTL; prune expired nodes.
2019-09-30 12:48:59 +01:00
Milos Gajdos
16c7b3a390
Added Registry TTL to memory registry. Tracking node lifetimes.
2019-09-30 12:48:59 +01:00
lubaoquan
866631df1d
fixes https://github.com/micro/go-micro/issues/793
2019-09-30 10:36:43 +08:00
Milos Gajdos
87a5e85062
Add 1.13 support. Fix tests to enable 1.13 support
2019-09-27 17:14:24 +01:00
Asim Aslam
ef7bb46884
Don't shutdown old nodes in mdns registry
2019-09-26 16:46:09 +01:00
Asim Aslam
2b8210a106
Preserve cache in the face of failure
2019-09-25 19:44:46 +01:00
Asim Aslam
7fe64192a7
Add flag for registry service client
2019-09-25 11:09:19 +01:00
Milos Gajdos
1f23c8a85a
Emit memory registry event only when it actually happens
2019-09-25 01:58:28 +01:00
Milos Gajdos
39755721d0
Fix proto formatting
2019-09-24 14:39:51 +01:00
Milos Gajdos
ccda1d3559
Remove rpc Sync method from registry handler
2019-09-24 10:41:48 +01:00
Milos Gajdos
61ee436cc4
Added Sync RPC call; it's identical to ListServices for now
2019-09-23 21:08:31 +01:00
Milos Gajdos
04a5d884da
Move global vars to the top of the src file: conventions
2019-09-23 20:48:25 +01:00
Milos Gajdos
0ec1b840fd
Add registry event to registry package
2019-09-23 20:48:25 +01:00
Asim Aslam
04b31d374c
Merge pull request #745 from micro/registry-service
...
Add service registry
2019-09-09 13:05:46 -07:00
Asim Aslam
2c16c7e62f
Fix build breaks
2019-09-09 09:25:47 -07:00
Asim Aslam
1f44d7a4a1
Add registry handler
2019-09-09 09:20:17 -07:00
Asim Aslam
b076ef906a
Add service registry
2019-09-09 08:57:57 -07:00
Asim Aslam
c669a2b155
Use .micro domain for mdns
2019-09-09 05:11:25 -07:00
Shu Xian
bf0e46dc0d
fix registry addr error for mq-rpc
2019-08-14 21:32:28 +08:00
johnson
de34f259ba
update service not found error tooltip
...
fixing test failed issue
change back error type
change registry.ErrNotFound back to selector.ErrNotFound
change back error type
change registry.ErrNotFound back to selector.ErrNotFound
remove the single node tunnel test
Fix read yaml config from memory
package main
import (
"fmt"
"github.com/micro/go-micro/config"
"github.com/micro/go-micro/config/source/memory"
)
var configData = []byte(`
---
a: 1234
`)
func main() {
memorySource := memory.NewSource(
memory.WithYAML(configData),
)
// Create new config
conf := config.NewConfig()
// Load file source
conf.Load(memorySource)
fmt.Println(string(conf.Bytes()))
}
2019-08-11 19:31:22 +08:00
Asim Aslam
edb0fe4b16
fix the consul setup code
2019-08-06 19:43:46 +01:00
Asim Aslam
e16420fdbd
Consul config fix https://github.com/micro/go-micro/pull/641
2019-08-06 09:15:38 +01:00
Asim Aslam
b806e7bdf5
Stop a goroutine leak in registy
2019-08-01 23:03:11 +01:00
Milos Gajdos
c108188d65
Preallocate nodes slice in addNodes before populating it
2019-07-15 14:47:33 +01:00
Milos Gajdos
609934ce99
Preallocate slices; avoide append() reallocations when copying data
2019-07-15 11:13:58 +01:00
Asim Aslam
1f744b31a4
Return the dead node when deleting the service
2019-07-10 21:03:53 +01:00
Asim Aslam
e0bf1c2283
Remove Port from registry
2019-07-08 08:01:42 +01:00
Asim Aslam
a412486c39
Update registry util semantics
2019-07-04 11:36:49 +01:00
0e34c572b4
export registry util function to safe copy registry data
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-04 11:39:43 +03:00
Milos Gajdos
f6e064cdbd
Fixed router idempotency. Return registry.ErrWatchStopped from mdns reg
2019-07-01 15:46:26 +01:00
Milos Gajdos
c3d2043caf
Reverts c0a628d65b024d1c1a95f9e6a0419d356da1e973
...
Fixes #540
2019-06-22 19:01:03 +01:00
Milos Gajdos
c0a628d65b
Simplified delService code; properly delete service nodes
2019-06-18 21:39:00 +01:00
Asim Aslam
7266c62d09
remove comment
2019-06-18 15:33:31 +01:00
Asim Aslam
6459cdfc21
propagate updates to local watchers
2019-06-18 14:42:56 +01:00
ab692ff590
remove mock data from memory registry
...
memory registry can be used as fast inprocess registry,
so mock data needs to be in tests only
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-06-13 00:51:56 +03:00
Milos Gajdos
73b0a0ed0e
Return registry.ErrWatcherStopped when consul watcher stops.
...
The original code returns "result chan closed" errors.Error which does
not carry higher semantics signal to downstream despite go-micro having
a clearly defined Error for this behaviour. This commit fixes that and
lets the downstream i.e. consumer of this code to act based on different
errors.
2019-06-09 15:51:27 +01:00
Asim Aslam
4035ab5c7b
Change go-log links
2019-05-31 00:38:05 +01:00
Asim Aslam
a353c83f47
Add rcache => cache
2019-05-31 00:22:43 +01:00
Blair McMillan
389d141c5a
Use existing consul client for watcher
2019-05-16 12:37:48 +10:00
58775249c5
fix race with rcache
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-09 23:02:32 +03:00
1a151a3348
fix data races in gossip registry
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-05-09 22:32:21 +03:00
Patrick Moore
afd1f9f50f
Update consul/watch import
...
The watch package was moved from github.com/hashicorp/consul/watch to github.com/hashicorp/consul/api/watch to live in the API module.
Per: 6c885d383a
2019-04-26 10:40:10 -07:00
Asim Aslam
df6561165a
gofmt
2019-04-23 07:13:21 +00:00
shuxian
d3f447a732
solve NewRegistry httpclient 'nil pointer dereference' bug
2019-02-28 09:56:57 +08:00
Asim Aslam
f4be7d018d
delete context file
2019-02-13 14:39:38 +00:00
Asim Aslam
7cb466359f
rework gossip registry
2019-02-13 14:39:20 +00:00
f961c571bd
registry: [gossip] fix panic
...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0xd1b215]
goroutine 8 [running]:
sync.(*RWMutex).RLock(...)
/var/home/vtolstov/sdk/go1.12beta2/src/sync/rwmutex.go:48
github.com/hashicorp/memberlist.(*Memberlist).LocalNode(0x0, 0x0)
/home/vtolstov/devel/projects/centralv2/vendor/github.com/hashicorp/memberlist/memberlist.go:417 +0x35
github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run.func3(0xc000155880)
/home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:565 +0xf5
created by github.com/micro/go-micro/registry/gossip.(*gossipRegistry).run
/home/vtolstov/devel/projects/centralv2/vendor/github.com/micro/go-micro/registry/gossip/gossip.go:553 +0xa25
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-13 16:36:38 +03:00
36532c94b2
registry: [gossip] add ConnectRetry and ConnectTimeout
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-12 17:16:35 +03:00
422e2002a0
registry: gossip unify registry option passing, optimize
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-02-02 01:12:39 +03:00
Asim Aslam
cead99ac44
fix nil pointer
2019-02-01 16:01:51 +00:00
Asim Aslam
88e12347d0
update mdns to remove race condition
2019-02-01 13:41:11 +00:00
Asim Aslam
652b1067f5
fix data race
2019-02-01 09:05:03 +00:00
Asim Aslam
48b80dd051
replace memory registry
2019-01-18 17:29:17 +00:00
Asim Aslam
7314af347b
Set MDNS as default registry
2019-01-15 16:50:37 +00:00
Asim Aslam
39c24baca9
rename mock things to memory
2019-01-14 15:27:25 +00:00
Asim Aslam
bb31480f1a
downgrade code generated stuff
2019-01-10 10:57:04 +00:00
xinfei.wu
eec1726f1d
add package comment
2019-01-09 16:31:23 +08:00
xinfei.wu
453ce2fcbe
add locker
2019-01-09 14:24:12 +08:00
Asim Aslam
5cae330732
Update selector race, rename cache selector
2018-12-29 15:44:51 +00:00
Asim Aslam
8b54a850f7
run gossip updater first
2018-12-19 19:04:44 +00:00
Asim Aslam
fae8c5eb4c
fix context
2018-12-19 09:27:53 +00:00
5bcdf189de
implement some gossip options
...
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2018-12-19 12:25:16 +03:00
Asim Aslam
b02e1e04fc
Add gossip readme
2018-12-06 18:26:51 +00:00
Asim Aslam
cf8c059711
Merge pull request #345 from micro/gossip
...
Gossip
2018-12-06 18:22:52 +00:00
Asim Aslam
b343420af6
update the gossiper
2018-12-06 18:19:05 +00:00
Asim Aslam
1ed2b589a2
log to dev null
2018-12-04 17:33:11 +00:00
Asim Aslam
72d8dc89fb
add cmd and bug fix
2018-12-04 17:22:20 +00:00
Asim Aslam
8706aa4a46
Remove file
2018-12-04 16:43:05 +00:00
Asim Aslam
57dcba666e
gossip registry
2018-12-04 16:41:40 +00:00
Blair McMillan
a9593bad66
Prevent read/write map concurrency issue
2018-12-03 14:59:31 +10:00
Asim Aslam
9c2689301c
add mock package comments
2018-12-01 12:56:21 +00:00
Asim Aslam
a1665ab37a
Add consul package comment
2018-12-01 12:54:46 +00:00
Asim Aslam
29bb63b717
add mdns package comment
2018-11-26 16:13:17 +00:00
Blair McMillan
7171c00e42
Add ability to specify Consul options and default to AllowStale for all gets
2018-11-23 17:11:37 +10:00
Blair McMillan
e3a2fe52cd
Only check if the service is in Consul once every deregister interval
2018-11-22 13:34:08 +10:00
Asim Aslam
4c821baab4
go fmt
2018-11-03 12:17:11 +00:00
lovelly
fd04722706
Fix tcp check no ttl error
2018-10-09 10:40:24 +08:00
Asim Aslam
9968c7d007
Add Init to all things, use init in cmd package to initialise
2018-08-08 18:57:29 +01:00
Asim Aslam
af328ee7b4
Support connect native registration
2018-08-06 17:12:34 +01:00
Shulhan
44b934d458
registry: rename context key "consul_register_tcp_check" to "consul_tcp_check"
2018-03-21 21:57:04 +07:00
Shulhan
65a90f5a21
registry.Register: use local variable to get context value
2018-03-21 18:18:48 +07:00
Shulhan
1eb4398b6c
registry/consul: rename "RegisterTCPCheck" to "TCPCheck"
2018-03-21 18:17:56 +07:00
Shulhan
68ab671bd0
Use registry.options.Context to set Consul TCP check option
2018-03-19 20:34:56 +07:00
Shulhan
f4cdfaf27f
Fix TCP address and port on service check registration
2018-03-19 20:34:12 +07:00
Shulhan
1599d717af
Add option to enable TCP check with Consul registry
...
One disadvantage of using TTL based health check is the high network
traffic between Consul agent (either between servers, or between server
and client).
In order for the services considered alive by Consul, microservices must
send an update TTL to Consul every n seconds (currently 30 seconds).
Here is the explanation about TTL check from Consul documentation [1]
Time to Live (TTL) - These checks retain their last known state for a
given TTL. The state of the check must be updated periodically over
the HTTP interface. If an external system fails to update the status
within a given TTL, the check is set to the failed state. This
mechanism, conceptually similar to a dead man's switch, relies on the
application to directly report its health. For example, a healthy app
can periodically PUT a status update to the HTTP endpoint; if the app
fails, the TTL will expire and the health check enters a critical
state. The endpoints used to update health information for a given
check are the pass endpoint and the fail endpoint. TTL checks also
persist their last known status to disk. This allows the Consul agent
to restore the last known status of the check across restarts.
Persisted check status is valid through the end of the TTL from the
time of the last check.
Hint:
TTL checks also persist their last known status to disk. This allows
the Consul agent to restore the last known status of the check
across restarts.
When microservices update the TTL, Consul will write to disk. Writing to
disk means all other slaves need to replicate it, which means master need
to inform other standby Consul to pull the new catalog. Hence, the
increased traffic.
More information about this issue can be viewed at Consul mailing list [2].
[1] https://www.consul.io/docs/agent/checks.html
[2] https://groups.google.com/forum/#!topic/consul-tool/84h7qmCCpjg
2018-03-14 19:40:59 +07:00
Asim Aslam
c9b40cb33b
switch to stdlib context
2018-03-03 11:53:52 +00:00
Asim Aslam
982e6068cf
support services without version
2018-03-01 17:35:13 +00:00
Asim Aslam
d0d9582b81
Merge pull request #206 from darren-west/master
...
Added Options() to registry interface
2018-02-19 20:52:28 +00:00
Asim Aslam
02260dcaa3
Add watch options
2018-02-19 17:12:37 +00:00
Siyun Wu
7c8d6087de
add https support for consul
...
using enviroment variables
for example:
export CONSUL_HTTP_SSL=1
export CONSUL_HTTP_ADDR="https://example.com "
export CONSUL_CLIENT_CERT="/Users/foo/.ssh/consul/consul.cert"
export CONSUL_CLIENT_KEY="/Users/foo/.ssh/consul/consul.key"
export CONSUL_CACERT="/Users/foo/.ssh/consul/ca.cert"
2017-11-20 15:34:52 +08:00
Asim Aslam
1f03681d82
set test to use localhost
2017-11-09 14:21:26 +00:00
Asim Aslam
1c1d46e1ac
Add some test logging
2017-11-09 14:16:35 +00:00
darren-west
d970586a29
Added Options() to registry interface
2017-09-28 11:16:56 +01:00
Sergey Sarbash
db0df07fd6
Check for uninitialized *config.HttpClient
2017-08-15 10:49:24 +03:00
Sergey Sarbash
fd01ead575
Fixes nil pointer dereferencing for Consul TLS transport
2017-08-15 09:27:39 +03:00
Emil Huseynaliev
9e1550db53
Update consul_watcher.go
...
`WatchPlan` was renamed to `Plan` in the consul `watch` package in commit d7e23857ad
2017-04-25 16:38:35 -04:00
Asim Aslam
90ed1390ee
fix broken test
2017-04-17 15:31:50 +01:00
wangkechun
059b9d36d7
fix fmt str
2017-02-25 22:53:25 +08:00
Asim Aslam
71d717a06d
strip doc.go files
2016-12-14 15:41:48 +00:00
Asim
c289f6acaa
Make use of consul 0.7 deregister field. Now auto reaps dead services
2016-11-25 11:23:37 +01:00
chriss
fabdd4a704
Remove consul token helper method.
...
A Consul config struct can be passed using the `Config` helper making this helper redundant.
2016-11-21 16:16:24 +00:00
Asim
f9709ffa6e
ensure the code does not panic
2016-11-18 07:30:50 +00:00
chriss
8a25723fe0
Set consul token via registry options.
...
Optionally configure a token to use with the consul client.
2016-11-18 00:07:12 +00:00
chriss
3d7187f405
Add the ability to pass consul client config via registry options.
...
This can be used when you need to configure the consul client to use a specific configuration (E.G to pass a Token if consul is using ACL policies)
2016-11-17 23:24:14 +00:00
Jelmer Snoeck
e59f7a7ace
ConsulRegistry: use health checks to select nodes.
...
Consul sees a healthcheck that is in the warning state as a "failed"
node. This means that when we ask Consul for services that are passing,
it would not return nodes that have warning healthchecks.
In the cache, we only check on critical to skip for nodes. This makes
the cache out of sync with the non-cache implementation.
This patch reworks the non-cache implementation to ask for all nodes
(even unhealthy ones) and does the same check as within the cache, skip
nodes that have critical healthchecks.
We've noticed this issue when we deployed custom healthchecks where the
cache was acting properly, but after 1 minute we saw "None Available"
errors. This is due to the TTL expiry on the cache, which is then
followed by doing a non cached request.
2016-08-26 08:36:45 +01:00
Asim
71d64f911f
make a copy of services for handle method
2016-08-24 18:37:11 +01:00
Asim
0afaaeec8d
make a copy of services
2016-08-24 18:27:15 +01:00
Jelmer Snoeck
81231c0b6f
ConsulWatcher: deregister if service checks fail.
2016-08-11 15:18:50 +01:00
Asim
2d6c403992
don't close next chan, instead use exit chan
2016-07-30 11:58:10 +01:00
Asim
6aac602b31
return error when zero services in mock registry
2016-06-30 20:11:04 +01:00
Asim
1254a87286
Add package comments
2016-05-24 22:22:46 +01:00
Asim
04bc20798d
Don't strip decode because its good to be backwards compatible still
2016-05-22 18:43:47 +01:00
Asim
2708f9c04b
No longer need to test old encoding
2016-05-22 18:41:06 +01:00
Asim
06ee80fd0a
Strip old encoding
2016-05-22 18:34:47 +01:00
Asim
e541d45f38
When the TTL flips to critical we should issue a delete event
2016-05-03 18:34:57 +01:00
Asim
d3de45409f
Simplify watcher test
2016-05-01 22:30:33 +01:00
Asim
7996785195
Try a different way of testing
2016-05-01 22:05:21 +01:00
Asim
3709831d8e
Watch results may be unordered
2016-05-01 21:38:22 +01:00
Asim
50eb97129e
Add watcher test
2016-05-01 21:30:14 +01:00
Asim
96104aa209
Add mdns test and fix the bug it revealed
2016-05-01 21:21:15 +01:00
Asim
e14f9a0380
Add watcher.... OH YEAAA
2016-05-01 19:31:03 +01:00
Asim
59f1a9a07b
Use mdns-sd service
2016-04-30 00:22:31 +01:00
Asim
ae8c948202
Use our fork of mdns with all the updates
2016-04-30 00:15:00 +01:00
Asim
c26f989bbb
Fix encoding so we split across txt records
2016-04-28 18:36:59 +01:00
Asim
6c108d95b2
First attempt at mdns
2016-04-27 18:21:05 +01:00
Asim
3d3044404e
Don't add to defaults in func init, just add them to cmd
2016-04-26 18:49:02 +01:00
Asim
f7c57fd4f4
Mock watcher that just blocks
2016-04-26 18:32:43 +01:00
Asim
e2855c4bc2
Fix some mapping issues while we're at it
2016-04-09 22:19:03 +01:00
Asim
9d7bd3f424
God damn you nil map
2016-04-09 21:34:45 +01:00
Asim
b3fbd36ba7
Don't re-register if the state hasn't changed
2016-04-09 21:30:31 +01:00