diff --git a/SUMMARY.md b/SUMMARY.md index 0e0b186..1859213 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -16,12 +16,18 @@ * [TLS Security](nats_server/tls.md) * [Logging](nats_server/logging.md) * [Monitoring](nats_server/monitoring.md) - * [Statistics](nats_server/natstop.md) - * [NATS Top Tutorial](nats_server/nats_top_tutorial.md) * [Signals](nats_server/signals.md) * [Window Service](nats_server/windows_srv.md) * [Upgrading a Cluster](nats_server/upgrading.md) +## Containerization + * [NATS.docker](nats_docker/README.md) + * [Tutorial](nats_docker/tutorial.md) + +## NATS Tools + * [NATS Top](nats_tools/nats_top/README.md) + * [Tutorial](nats_tools/nats_top/tutorial.md) + ## Developing With NATS * [Concepts](developer/concepts/intro.md) diff --git a/nats_server/nats_top_tutorial.md b/nats_server/nats_top_tutorial.md deleted file mode 100644 index 60a7e63..0000000 --- a/nats_server/nats_top_tutorial.md +++ /dev/null @@ -1,137 +0,0 @@ -## NATS TOP Tutorial - -You can use [nats-top](natstop.md) to monitor in realtime NATS server connections and message statistics. - -#### Prerequisites - -- [Set up your Go environment](/documentation/additional_documentation/go-install/) -- [Installed the NATS server](/documentation/managing_the_server/installing/) - -#### 1. Install nats-top - -```sh -% go get github.com/nats-io/nats-top -``` - -You may need to run the following instead: - -```sh -% sudo -E go get github.com/nats-io/nats-top -``` - -#### 2. Start the NATS server with monitoring enabled - -```sh -% nats-server -m 8222 -``` - -#### 3. Start nats-top - -```sh -% nats-top -``` - -Result: - -```sh -nats-server version 0.6.6 (uptime: 2m2s) -Server: - Load: CPU: 0.0% Memory: 6.3M Slow Consumers: 0 - In: Msgs: 0 Bytes: 0 Msgs/Sec: 0.0 Bytes/Sec: 0 - Out: Msgs: 0 Bytes: 0 Msgs/Sec: 0.0 Bytes/Sec: 0 - -Connections: 0 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION -``` - -#### 4. Run NATS client programs - -Run some NATS client programs and exchange messages. - -For the best experience, you will want to run multiple subscribers, at least 2 or 3. Refer to the [example pub-sub clients](/documentation/additional_documentation/nats-pub-sub). - -#### 5. Check nats-top for statistics - -```sh -nats-server version 0.6.6 (uptime: 30m51s) -Server: - Load: CPU: 0.0% Memory: 10.3M Slow Consumers: 0 - In: Msgs: 56 Bytes: 302 Msgs/Sec: 0.0 Bytes/Sec: 0 - Out: Msgs: 98 Bytes: 512 Msgs/Sec: 0.0 Bytes/Sec: 0 - -Connections: 3 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION - ::1:58651 6 1 0 52 0 260 0 go 1.1.0 - ::1:58922 38 1 0 21 0 105 0 go 1.1.0 - ::1:58953 39 1 0 21 0 105 0 go 1.1.0 -``` - -#### 6. Sort nats-top statistics - -In nats-top, enter the command `o` followed by the option, such as `bytes_to`. You see that nats-top sorts the BYTES_TO column in ascending order. - -```sh -nats-server version 0.6.6 (uptime: 45m40s) -Server: - Load: CPU: 0.0% Memory: 10.4M Slow Consumers: 0 - In: Msgs: 81 Bytes: 427 Msgs/Sec: 0.0 Bytes/Sec: 0 - Out: Msgs: 154 Bytes: 792 Msgs/Sec: 0.0 Bytes/Sec: 0 -sort by [bytes_to]: -Connections: 3 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION - ::1:59259 83 1 0 4 0 20 0 go 1.1.0 - ::1:59349 91 1 0 2 0 10 0 go 1.1.0 - ::1:59342 90 1 0 0 0 0 0 go 1.1.0 -``` - -#### 7. Use different sort options - -Use some different sort options to explore nats-top, such as: - -`cid`, `subs`, `pending`, `msgs_to`, `msgs_from`, `bytes_to`, `bytes_from`, `lang`, `version` - -You can also set the sort option on the command line using the `-sort` flag. For example: `nats-top -sort bytes_to`. - -#### 8. Display the registered subscriptions. - -In nats-top, enter the command `s` to toggle displaying connection subscriptions. When enabled, you see the subscription subject in nats-top table: - -```sh -nats-server version 0.6.6 (uptime: 1h2m23s) -Server: - Load: CPU: 0.0% Memory: 10.4M Slow Consumers: 0 - In: Msgs: 108 Bytes: 643 Msgs/Sec: 0.0 Bytes/Sec: 0 - Out: Msgs: 185 Bytes: 1.0K Msgs/Sec: 0.0 Bytes/Sec: 0 - -Connections: 3 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION SUBSCRIPTIONS - ::1:59708 115 1 0 6 0 48 0 go 1.1.0 foo.bar - ::1:59758 122 1 0 1 0 8 0 go 1.1.0 foo - ::1:59817 124 1 0 0 0 0 0 go 1.1.0 foo -``` - -#### 9. Quit nats-top - -Use the `q` command to quit nats-top. - -#### 10. Restart nats-top with a specified query - -For example, to query for the connection with largest number of subscriptions: - -```sh -% nats-top -n 1 -sort subs -``` - -Result: nats-top displays only the client connection with the largest number of subscriptions: - -```sh -nats-server version 0.6.6 (uptime: 1h7m0s) -Server: - Load: CPU: 0.0% Memory: 10.4M Slow Consumers: 0 - In: Msgs: 109 Bytes: 651 Msgs/Sec: 0.0 Bytes/Sec: 0 - Out: Msgs: 187 Bytes: 1.0K Msgs/Sec: 0.0 Bytes/Sec: 0 - -Connections: 3 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION - ::1:59708 115 1 0 6 0 48 0 go 1.1.0 -``` diff --git a/nats_server/natstop.md b/nats_server/natstop.md deleted file mode 100644 index aeadcd1..0000000 --- a/nats_server/natstop.md +++ /dev/null @@ -1,81 +0,0 @@ -## Statistics - -[nats-top](https://github.com/nats-io/nats-top) is a [top](http://man7.org/linux/man-pages/man1/top.1.html)-like tool for monitoring nats-server servers. - -The nats-top tool provides a dynamic real-time view of a NATS server. nats-top can display a variety of system summary information about the NATS server, such as subscription, pending bytes, number of messages, and more, in real time. For example: - -```sh -nats-top - -nats-server version 0.6.4 (uptime: 31m42s) -Server: - Load: CPU: 0.8% Memory: 5.9M Slow Consumers: 0 - In: Msgs: 34.2K Bytes: 3.0M Msgs/Sec: 37.9 Bytes/Sec: 3389.7 - Out: Msgs: 68.3K Bytes: 6.0M Msgs/Sec: 75.8 Bytes/Sec: 6779.4 - -Connections: 4 - HOST CID SUBS PENDING MSGS_TO MSGS_FROM BYTES_TO BYTES_FROM LANG VERSION SUBSCRIPTIONS - 127.0.0.1:56134 2 5 0 11.6K 11.6K 1.1M 905.1K go 1.1.0 foo, hello - 127.0.1.1:56138 3 1 0 34.2K 0 3.0M 0 go 1.1.0 _INBOX.a96f3f6853616154d23d1b5072 - 127.0.0.1:56144 4 5 0 11.2K 11.1K 873.5K 1.1M go 1.1.0 foo, hello - 127.0.0.1:56151 5 8 0 11.4K 11.5K 1014.6K 1.0M go 1.1.0 foo, hello -``` - -## Installation - -nats-top can be installed using `go get`. For example: - -```sh -go get github.com/nats-io/nats-top -``` - -NOTE: You may have to run the above command as user `sudo` depending on your setup. If you receive an error that you cannot install nats-top because your $GOPATH is not set, when in fact it is set, use command `sudo -E go get github.com/nats-io/nats-top` to install nats-top. The `-E` flag tells sudo to preserve the current user's environment. - -## Usage - -Once installed, nats-top can be run with the command `nats-top` and optional arguments. - -```sh -nats-top [-s server] [-m monitor] [-n num_connections] [-d delay_in_secs] [-sort by] -``` - -## Options - -Optional arguments inclde the following: - -| Option | Description | -|-----------------------|-----------------------------------------------| -| `-m monitor` | Monitoring http port from nats-server. | -| `-n num_connections` | Limit the connections requested to the server (default 1024). | -| `-d delay_in_secs` | Screen refresh interval (default 1 second). | -| `-sort by` | Field to use for sorting the connections (see below). | - -## Commands - -While in nats-top view, you can use the following commands. - -### option - -Use the `o