mirror of
https://github.com/taigrr/nats.docs
synced 2025-01-18 04:03:23 -08:00
updated generated book
This commit is contained in:
parent
2f1ed14f2c
commit
249e072d55
971
docs/nats_server/authentication.html
Normal file
971
docs/nats_server/authentication.html
Normal file
@ -0,0 +1,971 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Authentication · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="authorization.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="configuration.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Authentication</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="nats-server-authentication">NATS Server Authentication</h2>
|
||||
<p>You can enable authentication on the NATS server so that a client must authenticate its identity when connecting. The NATS server supports single user authentication via the command line or using a configuration file, and multi-user authentication via a configuration file. Single user authentication is truly single user. The server will accept one set of credentials and no other.</p>
|
||||
<h2 id="command-line-options">Command Line Options</h2>
|
||||
<p>You can start the NATS server with single-user authentication enabled by passing in the required credentials on the command line. The following server authentication options are supported on the command line:</p>
|
||||
<pre class="language-"><code>--user user User required for connections
|
||||
--pass password Password required for connections
|
||||
--auth token Authorization token required for connections
|
||||
</code></pre><p>Token is mutually exclusive from user and password, so only use one of those.</p>
|
||||
<p>For example:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -DV --user foo --pass bar
|
||||
</code></pre>
|
||||
<p>will allow the user <code>foo</code> to log in with the password <code>bar</code>, but no other users to access the server.</p>
|
||||
<p>Using the command line with an authorization token:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -DV -auth <span class="token string">'S3Cr3T0k3n!'</span>
|
||||
</code></pre>
|
||||
<p>will allow clients with that token to connect, and no others.</p>
|
||||
<h2 id="single-user-configuration-options">Single User Configuration Options</h2>
|
||||
<p>Single-user authentication can be configured in the configuration file:</p>
|
||||
<pre class="language-"><code class="lang-ascii">authorization {
|
||||
user: derek
|
||||
password: T0pS3cr3t
|
||||
timeout: 1
|
||||
}
|
||||
</code></pre>
|
||||
<p>If the server is part of a cluster, you can set up single-user authentication for route connections as well:</p>
|
||||
<pre class="language-"><code class="lang-ascii">cluster {
|
||||
authorization {
|
||||
user: route_user
|
||||
password: T0pS3cr3tT00!
|
||||
timeout: 0.5
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<p>Both of these configurations set a user and password as well as a connect timeout. The <code>auth</code> option can also be set to use tokens <em>instead of</em> user/password.</p>
|
||||
<h2 id="multi-user-authentication">Multi-User Authentication</h2>
|
||||
<p>Multi-user Authentication can only be set up in the configuration file. Users are defined in a list with user/password pairs.</p>
|
||||
<p>For example, to define two users <code>alice</code> and <code>bob</code>:</p>
|
||||
<pre class="language-"><code class="lang-ascii">authorization {
|
||||
users = [
|
||||
{user: alice, password: foo}
|
||||
{user: bob, password: bar}
|
||||
]
|
||||
}
|
||||
</code></pre>
|
||||
<p>You can also use <a href="../documentation/managing_the_server/configuration">variables</a> to set user and password values. For example, here a password is declared as a variable named PASS and assigned to Joe.</p>
|
||||
<pre class="language-"><code class="lang-ascii">authorization {
|
||||
PASS: abcdefghijklmnopqrstuvwxyz0123456789
|
||||
users = [
|
||||
{user: alice, password: foo}
|
||||
{user: bob, password: bar}
|
||||
{user: joe, password: $PASS}
|
||||
]
|
||||
}
|
||||
</code></pre>
|
||||
<p>The nats-server source code includes a tool that can be used to bcrypt passwords for the config file:</p>
|
||||
<pre class="language-"><code class="lang-sh"><span class="token operator">></span> go run mkpasswd.go -p
|
||||
<span class="token operator">></span> password: password
|
||||
<span class="token operator">></span> bcrypt hash: <span class="token variable">$2a</span><span class="token variable">$11</span><span class="token variable">$1oJy</span>/wZYNTxr9jNwMNwS3eUGhBpHT3On8CL9o7ey89mpgo88VG6ba
|
||||
</code></pre>
|
||||
<p>This allows you to store hashed passwords instead of plain text ones.</p>
|
||||
<h2 id="client-connection-string">Client connection string</h2>
|
||||
<p>To connect to the server as an authenticated client, you can pass in the credentials in the connection string.</p>
|
||||
<p>For example, user 'foo' with password 'bar':</p>
|
||||
<pre class="language-"><code class="lang-sh">nats://foo:bar@localhost:4222
|
||||
</code></pre>
|
||||
<p>Using token 'S3Cr3T0k3n!'</p>
|
||||
<pre class="language-"><code class="lang-sh">nats://S3Cr3T0k3n<span class="token operator">!</span>@localhost:4222
|
||||
</code></pre>
|
||||
<p>The server also supports TLS mutual authentication documented in the <a href="../documentation/managing_the_server/security">Security/Encryption section</a>. Other methods are also discussed in the <a href="../documentation/writing_applications/secure_connection">developer doc</a>.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="configuration.html" class="navigation navigation-prev " aria-label="Previous page: Configuration File">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="authorization.html" class="navigation navigation-next " aria-label="Next page: Authorization">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Authentication","level":"1.1.1.5.1","depth":4,"next":{"title":"Authorization","level":"1.1.1.5.2","depth":4,"path":"nats_server/authorization.md","ref":"nats_server/authorization.md","articles":[]},"previous":{"title":"Configuration File","level":"1.1.1.5","depth":3,"path":"nats_server/configuration.md","ref":"nats_server/configuration.md","articles":[{"title":"Authentication","level":"1.1.1.5.1","depth":4,"path":"nats_server/authentication.md","ref":"nats_server/authentication.md","articles":[]},{"title":"Authorization","level":"1.1.1.5.2","depth":4,"path":"nats_server/authorization.md","ref":"nats_server/authorization.md","articles":[]},{"title":"Clustering","level":"1.1.1.5.3","depth":4,"path":"nats_server/clustering.md","ref":"nats_server/clustering.md","articles":[]},{"title":"TLS Security","level":"1.1.1.5.4","depth":4,"path":"nats_server/tls.md","ref":"nats_server/tls.md","articles":[]},{"title":"Logging","level":"1.1.1.5.5","depth":4,"path":"nats_server/logging.md","ref":"nats_server/logging.md","articles":[]},{"title":"Monitoring","level":"1.1.1.5.6","depth":4,"path":"nats_server/monitoring.md","ref":"nats_server/monitoring.md","articles":[{"title":"Statistics","level":"1.1.1.5.6.1","depth":5,"path":"nats_server/natstop.md","ref":"nats_server/natstop.md","articles":[{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"path":"nats_server/nats_top_tutorial.md","ref":"nats_server/nats_top_tutorial.md","articles":[]}]}]}]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/authentication.md","mtime":"2019-05-15T18:36:53.562Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
946
docs/nats_server/authorization.html
Normal file
946
docs/nats_server/authorization.html
Normal file
@ -0,0 +1,946 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Authorization · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="clustering.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="authentication.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Authorization</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="authorization">Authorization</h2>
|
||||
<p>The NATS server supports authorization using subject-level permissions on a per-user basis. Permission-based authorization is available with <a href="../documentation/managing_the_server/authentication">multi-user authentication</a>.</p>
|
||||
<p>Each permission grant is an object with two fields: what subject(s) the authenticated user can publish to, and what subject(s) the authenticated user can subscribe to. The parser is generous at understanding what the intent is, so both arrays and singletons are processed. Subjects themselves can contain wildcards. Permissions can make use of <a href="../documentation/managing_the_server/configuration">variables</a>.</p>
|
||||
<p>You set permissions by creating an entry inside of the <code>authorization</code> configuration block that conforms to the following syntax:</p>
|
||||
<pre class="language-"><code class="lang-ascii">authorization {
|
||||
PERMISSION_NAME = {
|
||||
publish = "singleton" or ["array", ...]
|
||||
subscribe = "singleton" or ["array", ...]
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<p><strong>Important Note</strong> NATS Authorizations are whitelist only, meaning in order to not break request/reply patterns you need to add rules as above with Alice and Bob for the <code>_INBOX.></code> pattern. If an unauthorized client publishes or attempts to subscribe to a subject that has not been whitelisted, the action fails and is logged at the server, and an error message is returned to the client.</p>
|
||||
<h3 id="example">Example</h3>
|
||||
<p>Here is an example authorization configuration that defines four users, three of whom are assigned explicit permissions.</p>
|
||||
<pre class="language-"><code class="lang-ascii">authorization {
|
||||
ADMIN = {
|
||||
publish = ">"
|
||||
subscribe = ">"
|
||||
}
|
||||
REQUESTOR = {
|
||||
publish = ["req.foo", "req.bar"]
|
||||
subscribe = "_INBOX.>"
|
||||
}
|
||||
RESPONDER = {
|
||||
subscribe = ["req.foo", "req.bar"]
|
||||
publish = "_INBOX.>"
|
||||
}
|
||||
DEFAULT_PERMISSIONS = {
|
||||
publish = "SANDBOX.*"
|
||||
subscribe = ["PUBLIC.>", "_INBOX.>"]
|
||||
}
|
||||
PASS: abcdefghijklmnopqrstuvwxwz0123456789
|
||||
users = [
|
||||
{user: joe, password: foo, permissions: $ADMIN}
|
||||
{user: alice, password: bar, permissions: $REQUESTOR}
|
||||
{user: bob, password: $PASS, permissions: $RESPONDER}
|
||||
{user: charlie, password: bar}
|
||||
]
|
||||
}
|
||||
</code></pre>
|
||||
<p>Since Joe is an ADMIN he can publish/subscribe on any subject. We use the wildcard <code>></code> to match any subject.</p>
|
||||
<p>Alice is a REQUESTOR and can publish requests on subjects <code>req.foo</code> or <code>req.bar</code>, and subscribe to anything that is a response (<code>_INBOX.></code>).</p>
|
||||
<p>Charlie has no permissions granted and therefore inherits the default permission set. You set the inherited default permissions by assigning them to the default_permissions entry inside of the authorization configuration block.</p>
|
||||
<p>Bob is a RESPONDER to any of Alice's requests, so Bob needs to be able to subscribe to the request subjects and respond to Alice's reply subject which will be an <code>_INBOX.></code>.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="authentication.html" class="navigation navigation-prev " aria-label="Previous page: Authentication">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="clustering.html" class="navigation navigation-next " aria-label="Next page: Clustering">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Authorization","level":"1.1.1.5.2","depth":4,"next":{"title":"Clustering","level":"1.1.1.5.3","depth":4,"path":"nats_server/clustering.md","ref":"nats_server/clustering.md","articles":[]},"previous":{"title":"Authentication","level":"1.1.1.5.1","depth":4,"path":"nats_server/authentication.md","ref":"nats_server/authentication.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/authorization.md","mtime":"2019-05-15T18:45:32.117Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1027
docs/nats_server/clustering.html
Normal file
1027
docs/nats_server/clustering.html
Normal file
File diff suppressed because it is too large
Load Diff
961
docs/nats_server/logging.html
Normal file
961
docs/nats_server/logging.html
Normal file
@ -0,0 +1,961 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Logging · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="monitoring.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="tls.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Logging</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="configuring-logging">Configuring Logging</h2>
|
||||
<p>The NATS server provides various logging options that you can set via the command line or the configuration file.</p>
|
||||
<h3 id="command-line-options">Command Line Options</h3>
|
||||
<p>The following logging operations are supported:</p>
|
||||
<pre class="language-"><code>-l, --log FILE File to redirect log output.
|
||||
-T, --logtime Timestamp log entries (default is true).
|
||||
-s, --syslog Enable syslog as log method.
|
||||
-r, --remote_syslog Syslog server address.
|
||||
-D, --debug Enable debugging output.
|
||||
-V, --trace Trace the raw protocol.
|
||||
-DV Debug and Trace.
|
||||
</code></pre><h4 id="debug-and-trace">Debug and trace</h4>
|
||||
<p>The <code>-DV</code> flag enables trace and debug for the server.</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -DV -m 8222 -user foo -pass bar
|
||||
</code></pre>
|
||||
<h4 id="log-file-redirect">Log file redirect</h4>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -DV -m 8222 -l nats.log
|
||||
</code></pre>
|
||||
<h4 id="timestamp">Timestamp</h4>
|
||||
<p>If <code>-T false</code> then log entries are not timestamped. Default is true.</p>
|
||||
<h4 id="syslog">Syslog</h4>
|
||||
<p>You can configure syslog with <code>UDP</code>:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -s udp://localhost:514
|
||||
</code></pre>
|
||||
<p>or <code>syslog:</code></p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server -r syslog://<span class="token operator"><</span>hostname<span class="token operator">></span>:<span class="token operator"><</span>port<span class="token operator">></span>
|
||||
</code></pre>
|
||||
<p>For example:</p>
|
||||
<pre class="language-"><code class="lang-sh">syslog://logs.papertrailapp.com:26900
|
||||
</code></pre>
|
||||
<h3 id="using-the-configuration-file">Using the Configuration File</h3>
|
||||
<p>All of these settings are available in the configuration file as well.</p>
|
||||
<pre class="language-"><code class="lang-ascii">debug: false
|
||||
trace: true
|
||||
logtime: false
|
||||
log_file: "/tmp/nats-server.log"
|
||||
</code></pre>
|
||||
<h2 id="log-rotation-with-logrotate">Log Rotation with logrotate</h2>
|
||||
<p>NATS server does not provide tools to manage log files, but it does include mechanisms that make log rotation simple. We can use this mechanism with <a href="https://github.com/logrotate/logrotate" target="_blank">logrotate</a>; a simple standard Linux utility to rotate logs available on most distributions like Debian, Ubuntu, RedHat (CentOS), etc.</p>
|
||||
<p>For example, you could configure <code>logrotate</code> with:</p>
|
||||
<pre class="language-"><code class="lang-ascii">/path/to/nats-server.log {
|
||||
daily
|
||||
rotate 30
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
postrotate
|
||||
kill -SIGUSR1 `cat /var/run/nats-server.pid`
|
||||
endscript
|
||||
}
|
||||
</code></pre>
|
||||
<p>The first line specifies the location that the subsequent lines will apply to.</p>
|
||||
<p>The rest of the file specifies that the logs will rotate daily ("daily" option) and that 30 older copies will be preserved ("rotate" option). Other options are described in <a href="https://linux.die.net/man/8/logrotate" target="_blank">logrorate documentation</a>.</p>
|
||||
<p>The "postrotate" section tells NATS server to reload the log files once the rotation is complete. The command <code>kill -SIGUSR1 `cat /var/run/nats-server.pid` </code> does not kill the NATS server process, but instead sends it a signal causing it to reload its log files. This will cause new requests to be logged to the refreshed log file.</p>
|
||||
<p>The <code>/var/run/nats-server.pid</code> file is where NATS server stores the master process's pid.</p>
|
||||
<h2 id="some-logging-notes">Some Logging Notes</h2>
|
||||
<ul>
|
||||
<li>The NATS Server, in verbose mode, will log the receipt of <code>UNSUB</code> messages, but this does not indicate the subscription is gone, only that the message was received. The <code>DELSUB</code> message in the log can be used to determine when the actual subscription removal has taken place.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="tls.html" class="navigation navigation-prev " aria-label="Previous page: TLS Security">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="monitoring.html" class="navigation navigation-next " aria-label="Next page: Monitoring">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Logging","level":"1.1.1.5.5","depth":4,"next":{"title":"Monitoring","level":"1.1.1.5.6","depth":4,"path":"nats_server/monitoring.md","ref":"nats_server/monitoring.md","articles":[{"title":"Statistics","level":"1.1.1.5.6.1","depth":5,"path":"nats_server/natstop.md","ref":"nats_server/natstop.md","articles":[{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"path":"nats_server/nats_top_tutorial.md","ref":"nats_server/nats_top_tutorial.md","articles":[]}]}]},"previous":{"title":"TLS Security","level":"1.1.1.5.4","depth":4,"path":"nats_server/tls.md","ref":"nats_server/tls.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/logging.md","mtime":"2019-05-15T18:35:35.115Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1044
docs/nats_server/monitoring.html
Normal file
1044
docs/nats_server/monitoring.html
Normal file
File diff suppressed because it is too large
Load Diff
996
docs/nats_server/nats_top_tutorial.html
Normal file
996
docs/nats_server/nats_top_tutorial.html
Normal file
@ -0,0 +1,996 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>NATS Top Tutorial · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="signals.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="natstop.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >NATS Top Tutorial</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="nats-top-tutorial">NATS TOP Tutorial</h2>
|
||||
<p>You can use <a href="natstop.html">nats-top</a> to monitor in realtime NATS server connections and message statistics.</p>
|
||||
<h4 id="prerequisites">Prerequisites</h4>
|
||||
<ul>
|
||||
<li><a href="../documentation/additional_documentation/go-install">Set up your Go environment</a></li>
|
||||
<li><a href="../documentation/managing_the_server/installing">Installed the NATS server</a></li>
|
||||
</ul>
|
||||
<h4 id="1-install-nats-top">1. Install nats-top</h4>
|
||||
<pre class="language-"><code class="lang-sh">% go get github.com/nats-io/nats-top
|
||||
</code></pre>
|
||||
<p>You may need to run the following instead:</p>
|
||||
<pre class="language-"><code class="lang-sh">% <span class="token function">sudo</span> -E go get github.com/nats-io/nats-top
|
||||
</code></pre>
|
||||
<h4 id="2-start-the-nats-server-with-monitoring-enabled">2. Start the NATS server with monitoring enabled</h4>
|
||||
<pre class="language-"><code class="lang-sh">% nats-server -m 8222
|
||||
</code></pre>
|
||||
<h4 id="3-start-nats-top">3. Start nats-top</h4>
|
||||
<pre class="language-"><code class="lang-sh">% nats-top
|
||||
</code></pre>
|
||||
<p>Result:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server version 0.6.6 <span class="token punctuation">(</span>uptime: 2m2s<span class="token punctuation">)</span>
|
||||
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
|
||||
</code></pre>
|
||||
<h4 id="4-run-nats-client-programs">4. Run NATS client programs</h4>
|
||||
<p>Run some NATS client programs and exchange messages.</p>
|
||||
<p>For the best experience, you will want to run multiple subscribers, at least 2 or 3. Refer to the <a href="../documentation/additional_documentation/nats-pub-sub">example pub-sub clients</a>.</p>
|
||||
<h4 id="5-check-nats-top-for-statistics">5. Check nats-top for statistics</h4>
|
||||
<pre class="language-"><code class="lang-sh">nats-server version 0.6.6 <span class="token punctuation">(</span>uptime: 30m51s<span class="token punctuation">)</span>
|
||||
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
|
||||
</code></pre>
|
||||
<h4 id="6-sort-nats-top-statistics">6. Sort nats-top statistics</h4>
|
||||
<p>In nats-top, enter the command <code>o</code> followed by the option, such as <code>bytes_to</code>. You see that nats-top sorts the BYTES_TO column in ascending order.</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server version 0.6.6 <span class="token punctuation">(</span>uptime: 45m40s<span class="token punctuation">)</span>
|
||||
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
|
||||
<span class="token function">sort</span> by <span class="token punctuation">[</span>bytes_to<span class="token punctuation">]</span>:
|
||||
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
|
||||
</code></pre>
|
||||
<h4 id="7-use-different-sort-options">7. Use different sort options</h4>
|
||||
<p>Use some different sort options to explore nats-top, such as:</p>
|
||||
<p><code>cid</code>, <code>subs</code>, <code>pending</code>, <code>msgs_to</code>, <code>msgs_from</code>, <code>bytes_to</code>, <code>bytes_from</code>, <code>lang</code>, <code>version</code></p>
|
||||
<p>You can also set the sort option on the command line using the <code>-sort</code> flag. For example: <code>nats-top -sort bytes_to</code>.</p>
|
||||
<h4 id="8-display-the-registered-subscriptions">8. Display the registered subscriptions.</h4>
|
||||
<p>In nats-top, enter the command <code>s</code> to toggle displaying connection subscriptions. When enabled, you see the subscription subject in nats-top table:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server version 0.6.6 <span class="token punctuation">(</span>uptime: 1h2m23s<span class="token punctuation">)</span>
|
||||
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
|
||||
</code></pre>
|
||||
<h4 id="9-quit-nats-top">9. Quit nats-top</h4>
|
||||
<p>Use the <code>q</code> command to quit nats-top.</p>
|
||||
<h4 id="10-restart-nats-top-with-a-specified-query">10. Restart nats-top with a specified query</h4>
|
||||
<p>For example, to query for the connection with largest number of subscriptions:</p>
|
||||
<pre class="language-"><code class="lang-sh">% nats-top -n 1 -sort subs
|
||||
</code></pre>
|
||||
<p>Result: nats-top displays only the client connection with the largest number of subscriptions:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-server version 0.6.6 <span class="token punctuation">(</span>uptime: 1h7m0s<span class="token punctuation">)</span>
|
||||
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
|
||||
</code></pre>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="natstop.html" class="navigation navigation-prev " aria-label="Previous page: Statistics">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="signals.html" class="navigation navigation-next " aria-label="Next page: Signals">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"next":{"title":"Signals","level":"1.1.1.6","depth":3,"path":"nats_server/signals.md","ref":"nats_server/signals.md","articles":[]},"previous":{"title":"Statistics","level":"1.1.1.5.6.1","depth":5,"path":"nats_server/natstop.md","ref":"nats_server/natstop.md","articles":[{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"path":"nats_server/nats_top_tutorial.md","ref":"nats_server/nats_top_tutorial.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/nats_top_tutorial.md","mtime":"2019-05-15T19:05:37.999Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
972
docs/nats_server/natstop.html
Normal file
972
docs/nats_server/natstop.html
Normal file
@ -0,0 +1,972 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Statistics · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="nats_top_tutorial.html" />
|
||||
|
||||
|
||||
<link rel="prev" href="monitoring.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Statistics</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="statistics">Statistics</h2>
|
||||
<p><a href="https://github.com/nats-io/nats-top" target="_blank">nats-top</a> is a <a href="http://man7.org/linux/man-pages/man1/top.1.html" target="_blank">top</a>-like tool for monitoring nats-server servers.</p>
|
||||
<p>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:</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-top
|
||||
|
||||
nats-server version 0.6.4 <span class="token punctuation">(</span>uptime: 31m42s<span class="token punctuation">)</span>
|
||||
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
|
||||
</code></pre>
|
||||
<h2 id="installation">Installation</h2>
|
||||
<p>nats-top can be installed using <code>go get</code>. For example:</p>
|
||||
<pre class="language-"><code class="lang-sh">go get github.com/nats-io/nats-top
|
||||
</code></pre>
|
||||
<p>NOTE: You may have to run the above command as user <code>sudo</code> 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 <code>sudo -E go get github.com/nats-io/nats-top</code> to install nats-top. The <code>-E</code> flag tells sudo to preserve the current user's environment.</p>
|
||||
<h2 id="usage">Usage</h2>
|
||||
<p>Once installed, nats-top can be run with the command <code>nats-top</code> and optional arguments.</p>
|
||||
<pre class="language-"><code class="lang-sh">nats-top <span class="token punctuation">[</span>-s server<span class="token punctuation">]</span> <span class="token punctuation">[</span>-m monitor<span class="token punctuation">]</span> <span class="token punctuation">[</span>-n num_connections<span class="token punctuation">]</span> <span class="token punctuation">[</span>-d delay_in_secs<span class="token punctuation">]</span> <span class="token punctuation">[</span>-sort by<span class="token punctuation">]</span>
|
||||
</code></pre>
|
||||
<h2 id="options">Options</h2>
|
||||
<p>Optional arguments inclde the following:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>-m monitor</code></td>
|
||||
<td>Monitoring http port from nats-server.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-n num_connections</code></td>
|
||||
<td>Limit the connections requested to the server (default 1024).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-d delay_in_secs</code></td>
|
||||
<td>Screen refresh interval (default 1 second).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>-sort by</code></td>
|
||||
<td>Field to use for sorting the connections (see below).</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 id="commands">Commands</h2>
|
||||
<p>While in nats-top view, you can use the following commands.</p>
|
||||
<h3 id="option">option</h3>
|
||||
<p>Use the <code>o<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span><span class="token punctuation">></span></span></code> command to set the primary sort key to the <code><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>option</span><span class="token punctuation">></span></span></code> value. The option value can be one of the following: <code>cid</code>, <code>subs</code>, <code>pending</code>, <code>msgs_to</code>, <code>msgs_from</code>, <code>bytes_to</code>, <code>bytes_from</code>, <code>lang</code>, <code>version</code>.</p>
|
||||
<p>You can also set the sort option on the command line using the <code>-sort</code> flag. For example: <code>nats-top -sort bytes_to</code>.</p>
|
||||
<h3 id="limit">limit</h3>
|
||||
<p>Use the <code>n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>limit</span><span class="token punctuation">></span></span></code> command to set the sample size of connections to request from the server.</p>
|
||||
<p>You can also set this on the command line using the <code>-n num_connections</code> flag. For example: <code>nats-top -n 1</code>.</p>
|
||||
<p>Note that if <code>n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>limit</span><span class="token punctuation">></span></span></code> is used in conjunction with <code>-sort</code>, the server will respect both options allowing queries such as the following: Query for the connection with largest number of subscriptions: <code>nats-top -n 1 -sort subs</code>.</p>
|
||||
<h3 id="s--and-q-commands">s, ? and q Commands</h3>
|
||||
<p>Use the <code>s</code> command to toggle displaying connection subscriptions.</p>
|
||||
<p>Use the <code>?</code> command to show help message with options.</p>
|
||||
<p>Use the <code>q</code> command to quit nats-top.</p>
|
||||
<h3 id="tutorial">Tutorial</h3>
|
||||
<p>For a walkthrough with <code>nats-top</code> check out the <a href="../documentation/additional_documentation/nats-top">tutorial</a>.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="monitoring.html" class="navigation navigation-prev " aria-label="Previous page: Monitoring">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="nats_top_tutorial.html" class="navigation navigation-next " aria-label="Next page: NATS Top Tutorial">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Statistics","level":"1.1.1.5.6.1","depth":5,"next":{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"path":"nats_server/nats_top_tutorial.md","ref":"nats_server/nats_top_tutorial.md","articles":[]},"previous":{"title":"Monitoring","level":"1.1.1.5.6","depth":4,"path":"nats_server/monitoring.md","ref":"nats_server/monitoring.md","articles":[{"title":"Statistics","level":"1.1.1.5.6.1","depth":5,"path":"nats_server/natstop.md","ref":"nats_server/natstop.md","articles":[{"title":"NATS Top Tutorial","level":"1.1.1.5.6.1.1","depth":6,"path":"nats_server/nats_top_tutorial.md","ref":"nats_server/nats_top_tutorial.md","articles":[]}]}]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/natstop.md","mtime":"2019-05-15T19:03:04.582Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
1065
docs/nats_server/tls.html
Normal file
1065
docs/nats_server/tls.html
Normal file
File diff suppressed because it is too large
Load Diff
949
docs/nats_server/upgrading.html
Normal file
949
docs/nats_server/upgrading.html
Normal file
@ -0,0 +1,949 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="" >
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Upgrading a Cluster · NATS</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.3">
|
||||
<meta name="author" content="The NATS Maintainers">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/style.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta name="HandheldFriendly" content="true"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
|
||||
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
|
||||
|
||||
|
||||
<link rel="next" href="../developer/" />
|
||||
|
||||
|
||||
<link rel="prev" href="windows_srv.html" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/3.6.95/css/materialdesignicons.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div class="book">
|
||||
<div class="book-summary">
|
||||
|
||||
|
||||
<div id="book-search-input" role="search">
|
||||
<input type="text" placeholder="Type to search" />
|
||||
</div>
|
||||
|
||||
|
||||
<nav role="navigation">
|
||||
|
||||
|
||||
|
||||
<ul class="summary">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1" data-path="../">
|
||||
|
||||
<a href="../">
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1" data-path="./">
|
||||
|
||||
<a href="./">
|
||||
|
||||
|
||||
NATS Server
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.1" data-path="installation.html">
|
||||
|
||||
<a href="installation.html">
|
||||
|
||||
|
||||
Installing
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.2" data-path="running.html">
|
||||
|
||||
<a href="running.html">
|
||||
|
||||
|
||||
Running
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.3" data-path="clients.html">
|
||||
|
||||
<a href="clients.html">
|
||||
|
||||
|
||||
Clients
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.4" data-path="flags.html">
|
||||
|
||||
<a href="flags.html">
|
||||
|
||||
|
||||
Flags
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5" data-path="configuration.html">
|
||||
|
||||
<a href="configuration.html">
|
||||
|
||||
|
||||
Configuration File
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.1" data-path="authentication.html">
|
||||
|
||||
<a href="authentication.html">
|
||||
|
||||
|
||||
Authentication
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.2" data-path="authorization.html">
|
||||
|
||||
<a href="authorization.html">
|
||||
|
||||
|
||||
Authorization
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.3" data-path="clustering.html">
|
||||
|
||||
<a href="clustering.html">
|
||||
|
||||
|
||||
Clustering
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.4" data-path="tls.html">
|
||||
|
||||
<a href="tls.html">
|
||||
|
||||
|
||||
TLS Security
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.5" data-path="logging.html">
|
||||
|
||||
<a href="logging.html">
|
||||
|
||||
|
||||
Logging
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6" data-path="monitoring.html">
|
||||
|
||||
<a href="monitoring.html">
|
||||
|
||||
|
||||
Monitoring
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1" data-path="natstop.html">
|
||||
|
||||
<a href="natstop.html">
|
||||
|
||||
|
||||
Statistics
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.1.1.5.6.1.1" data-path="nats_top_tutorial.html">
|
||||
|
||||
<a href="nats_top_tutorial.html">
|
||||
|
||||
|
||||
NATS Top Tutorial
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.6" data-path="signals.html">
|
||||
|
||||
<a href="signals.html">
|
||||
|
||||
|
||||
Signals
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.1.1.7" data-path="windows_srv.html">
|
||||
|
||||
<a href="windows_srv.html">
|
||||
|
||||
|
||||
Window Service
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter active" data-level="1.1.1.8" data-path="upgrading.html">
|
||||
|
||||
<a href="upgrading.html">
|
||||
|
||||
|
||||
Upgrading a Cluster
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.2" data-path="../developer/">
|
||||
|
||||
<a href="../developer/">
|
||||
|
||||
|
||||
Developing with NATS
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.2.1" data-path="../developer/connecting.html">
|
||||
|
||||
<a href="../developer/connecting.html">
|
||||
|
||||
|
||||
Connecting
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="divider"></li>
|
||||
|
||||
<li>
|
||||
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
|
||||
Published with GitBook
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="book-body">
|
||||
|
||||
<div class="body-inner">
|
||||
|
||||
|
||||
|
||||
<div class="book-header" role="navigation">
|
||||
|
||||
|
||||
<!-- Title -->
|
||||
<h1>
|
||||
<i class="fa fa-circle-o-notch fa-spin"></i>
|
||||
<a href=".." >Upgrading a Cluster</a>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="page-wrapper" tabindex="-1" role="main">
|
||||
<div class="page-inner">
|
||||
|
||||
<div id="book-search-results">
|
||||
<div class="search-noresults">
|
||||
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h2 id="cluster-upgrading">Cluster Upgrading</h2>
|
||||
<p>The basic strategy for upgrading a cluster revolves around the server's ability to gossip cluster configuration to clients and other servers. When cluster configuration changes, clients become aware of new servers automatically. In case of a disconnect, a client has a list of servers that joined the cluster in addition to the ones it knew about from its connection settings. </p>
|
||||
<p>Note that since each server stores it's own permission and authentication configuration, new servers added to a cluster should provide the same users and authorization to prevent clients from getting rejected or gaining unexpected privileges.</p>
|
||||
<p>For purposes of describing the scenario, let's get some fingers on keyboards, and go through the motions. Let's consider a cluster of two servers: 'A' and 'B.', and yes - clusters should be <em>three</em> to <em>five</em> servers, but for purposes of describing the behavior and cluster upgrade process, a cluster of two servers will suffice. </p>
|
||||
<p>Let's build this cluster:</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4222 -cluster nats://localhost:6222 -routes nats://localhost:6222,nats://localhost:6333
|
||||
</code></pre>
|
||||
<p>The command above is starting nats-server with debug output enabled, listening for clients on port 4222, and accepting cluster connections on port 6222. The <code>-routes</code> option specifies a list of nats URLs where the server will attempt to connect
|
||||
to other servers. These URLs define the cluster ports enabled on the cluster peers.</p>
|
||||
<p>Keen readers will notice a self-route. Gnatsd will ignore the self-route, but it makes for a single consistent configuration for all servers.</p>
|
||||
<p>You will see the server started, we notice it emits some warnings because it cannot connect to 'localhost:6333'. The message more accurately reads:</p>
|
||||
<pre class="language-"><code class="lang-ascii"> Error trying to connect to route: dial tcp localhost:6333: connect: connection refused
|
||||
</code></pre>
|
||||
<p>Let's fix that, by starting the second server:</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4333 -cluster nats://localhost:6333 -routes nats://localhost:6222,nats://localhost:6333
|
||||
</code></pre>
|
||||
<p>The second server was started on port 4333 with its cluster port on 6333. Otherwise the same as 'A.'</p>
|
||||
<p>Let's get one client, so we can observe it moving between servers as servers get removed:</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-sub -s nats://localhost:4222 <span class="token string">">"</span>
|
||||
</code></pre>
|
||||
<p>Nats-sub is a subscriber sample included with all NATS clients. Nats-sub subscribes to a subject and prints out any messages received. You can find the source code to the go version of nats-sub [here)(<a href="https://github.com/nats-io/go-nats/tree/master/examples" target="_blank">https://github.com/nats-io/go-nats/tree/master/examples</a>). After starting the subscriber you should see a message on 'A' that a new client connected.</p>
|
||||
<p>We have two servers and a client. Time to simulate our rolling upgrade. But wait, before we upgrade 'A,' let's introduce a new server 'T.' Server 'T' will join the existing cluster while we perform the upgrade. Its sole purpose is to provide an additional place where clients can go besides 'A.' and ensure we don't end up with a single server serving all the clients after the upgrade procedure. Clients will randomly select a server when connecting unless a special option is provided that disables that functionality (usually called 'DontRandomize' or 'noRandomize'). You can read more about <a href="https://www.nats.io/documentation/writing_applications/connecting/" target="_blank">"Avoiding the Thundering Herd"</a>.
|
||||
Suffice it to say that clients redistribute themselves about evenly between all servers in the cluster. In our case 1/2 of the clients on 'A' will jump over to 'B' and the remaining half to 'T.'</p>
|
||||
<p>Let's start our temporary server:</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4444 -cluster nats://localhost:6444 -routes nats://localhost:6222,nats://localhost:6333
|
||||
</code></pre>
|
||||
<p>After an instant or so, clients on 'A' learn of the new cluster member that joined. On our hands-on tutorial, <code>nats-sub</code> is now aware of 3 possible servers, 'A' (specified when we started the tool) and 'B' and 'T' learned from the cluster gossip.</p>
|
||||
<p>We invoke our admin powers and turn off 'A' by issuing a <code>CTRL+C</code> to the terminal on 'A,' and observe that either 'B' or 'T' reports that a new client connected. That is our <code>nats-sub</code> client.</p>
|
||||
<p>We perform the upgrade process, update the binary for 'A', and restart 'A':</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4222 -cluster nats://localhost:6222 -routes nats://localhost:6222,nats://localhost:6333
|
||||
</code></pre>
|
||||
<p>We move on to upgrade 'B'. Notice that clients from 'B' reconnect to 'A' and 'T'. We upgrade and restart 'B':</p>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4333 -cluster nats://localhost:6333 -routes nats://localhost:6222,nats://localhost:6333
|
||||
</code></pre>
|
||||
<p>If we had more servers, we would continue the stop, update, restart rotation as we did for 'A' and 'B.' After restarting the last server, we can go ahead and turn off 'T.' Any clients on 'T' will redistribute to our permanent cluster members.</p>
|
||||
<h3 id="seed-servers">Seed Servers</h3>
|
||||
<p>In the examples above we started nats-server specifying two clustering routes. It is possible to allow the server gossip protocol drive it and reduce the amount of configuration. You could for example start A, B and C as follows:</p>
|
||||
<h4 id="a---seed-server">A - Seed Server</h4>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4222 -cluster nats://localhost:6222
|
||||
</code></pre>
|
||||
<h4 id="b">B</h4>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4333 -cluster nats://localhost:6333 -routes nats://localhost:6222
|
||||
</code></pre>
|
||||
<h4 id="c">C</h4>
|
||||
<pre class="language-"><code class="lang-bash">nats-server -D -p 4444 -cluster nats://localhost:6444 -routes nats://localhost:6222
|
||||
</code></pre>
|
||||
<p>Once they connect to the 'seed server', the will learn about all the other servers and connect to each other forming the full mesh.</p>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<div class="search-results">
|
||||
<div class="has-results">
|
||||
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
|
||||
</div>
|
||||
<div class="no-results">
|
||||
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<a href="windows_srv.html" class="navigation navigation-prev " aria-label="Previous page: Window Service">
|
||||
<i class="fa fa-angle-left"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../developer/" class="navigation navigation-next " aria-label="Next page: Developing with NATS">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Upgrading a Cluster","level":"1.1.1.8","depth":3,"next":{"title":"Developing with NATS","level":"1.2","depth":1,"path":"developer/README.md","ref":"developer/README.md","articles":[{"title":"Connecting","level":"1.2.1","depth":2,"path":"developer/connecting.md","ref":"developer/connecting.md","articles":[]}]},"previous":{"title":"Window Service","level":"1.1.1.7","depth":3,"path":"nats_server/windows_srv.md","ref":"nats_server/windows_srv.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","include-html"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"include-html":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"The NATS Maintainers","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"NATS","gitbook":"*","description":"Administrative, developer and conceptual documentation for the NATS messaging system."},"file":{"path":"nats_server/upgrading.md","mtime":"2019-05-15T18:52:13.877Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-05-15T19:18:57.723Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<!-- Viz Support -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js"> </script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/lite.render.js"> </script>
|
||||
|
||||
<!-- Site code -->
|
||||
<script>
|
||||
function flash(elem, text, speed) {
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
var s = elem.style;
|
||||
elem.textContent = text;
|
||||
s.display = 'block';
|
||||
s.opacity = 1;
|
||||
(function fade() {
|
||||
(s.opacity -= .1) < .1 ? s.display = "none" : setTimeout(fade, speed)
|
||||
})();
|
||||
}
|
||||
|
||||
function copyToClipboard(text, el) {
|
||||
var copyTest = document.queryCommandSupported('copy');
|
||||
var elOriginalText = el.getAttribute('data-original-title');
|
||||
|
||||
if (copyTest === true) {
|
||||
var copyTextArea = document.createElement("textarea");
|
||||
copyTextArea.value = text;
|
||||
document.body.appendChild(copyTextArea);
|
||||
copyTextArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? 'Copied!' : 'Whoops, not copied!';
|
||||
var parent = el.parentNode.parentNode;
|
||||
var msgElem = parent.querySelector(".copy-msg");
|
||||
flash(msgElem, msg, 100);
|
||||
} catch (err) {
|
||||
console.log('Oops, unable to copy', err);
|
||||
}
|
||||
document.body.removeChild(copyTextArea);
|
||||
el.setAttribute('data-original-title', elOriginalText);
|
||||
} else {
|
||||
// Fallback if browser doesn't support .execCommand('copy')
|
||||
window.prompt("Copy to clipboard: Ctrl+C or Command+C, Enter", text);
|
||||
}
|
||||
}
|
||||
|
||||
function processGraphVizSections(elements) {
|
||||
var elements = document.querySelectorAll("[data-viz]");
|
||||
var viz = new Viz();
|
||||
Array.prototype.forEach.call(elements, function (x) {
|
||||
var engine = x.getAttribute("data-viz");
|
||||
var image = viz.renderImageElement(x.innerText, {
|
||||
format: "png",
|
||||
engine: engine
|
||||
}).then(function (element) {
|
||||
x.parentNode.insertBefore(element, x);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
function updateLanguageParameter(value) {
|
||||
const param = "lang";
|
||||
|
||||
if (window.location.href.indexOf("?") >= 0) {
|
||||
const regExp = new RegExp(param + "(.+?)(&|$)", "g");
|
||||
const newUrl = window.location.href.replace(regExp, param + "=" + encodeURIComponent(value) + "$2");
|
||||
window.history.pushState("", "", newUrl);
|
||||
} else {
|
||||
const newUrl = window.location.href + "?" + param + "=" + encodeURIComponent(value);
|
||||
window.history.pushState("", "", newUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function getLanguageParameter() {
|
||||
var match = RegExp('[?&]lang=([^&]*)').exec(window.location.search);
|
||||
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
|
||||
}
|
||||
|
||||
function docReady() {
|
||||
window.gitbook.events.bind("page.change", function () {
|
||||
pageChanged();
|
||||
});
|
||||
}
|
||||
|
||||
function pageChanged() {
|
||||
document.querySelectorAll('.js-copy').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var el = this;
|
||||
var parent = this.parentNode.parentNode;
|
||||
var code = parent.querySelector('code');
|
||||
var text = code.textContent || code.innerText;
|
||||
copyToClipboard(text, el);
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('.api-lang').forEach(elem => {
|
||||
elem.addEventListener("click", function () {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var lang = this.getAttribute('data-language');
|
||||
|
||||
// Stop the infinite loop
|
||||
if (curLang == lang) {
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.setItem('nats-api-language', lang); // So we only do this 1x
|
||||
|
||||
updateLanguageParameter(lang)
|
||||
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
if (sessionStorage) {
|
||||
var curLang = sessionStorage.getItem('nats-api-language');
|
||||
var queryLang = getLanguageParameter();
|
||||
var lang = curLang;
|
||||
|
||||
if (queryLang) { // query takes precedent
|
||||
lang = queryLang
|
||||
}
|
||||
|
||||
if (lang) {
|
||||
document.querySelectorAll('.api-lang[data-language=' + lang + ']').forEach(elem => {
|
||||
elem.click();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
processGraphVizSections();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
if (document.readyState != 'loading') docReady();
|
||||
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', docReady);
|
||||
else document.attachEvent('onreadystatechange', function () {
|
||||
if (document.readyState == 'complete') docReady();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Github Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
div.graphviz {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
padding-top: 15px;
|
||||
padding-right: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
code[data-viz] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-wrap {
|
||||
transition: 0.3s box-shadow ease;
|
||||
border-radius: 6px;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
list-style: none;
|
||||
background-color: #fff;
|
||||
margin: 10px 0;
|
||||
/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);*/
|
||||
}
|
||||
|
||||
.tab-wrap:hover {
|
||||
box-shadow: 0 12px 23px rgba(0, 0, 0, 0.23), 0 10px 10px rgba(0, 0, 0, 0.19);
|
||||
}
|
||||
|
||||
.tab {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Using scss these would be generated, we have to manually create enough for all tabs, start with 8 */
|
||||
.tab:checked:nth-of-type(1)~.tab__content:nth-of-type(1) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(2)~.tab__content:nth-of-type(2) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(3)~.tab__content:nth-of-type(3) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(4)~.tab__content:nth-of-type(4) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(5)~.tab__content:nth-of-type(5) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(6)~.tab__content:nth-of-type(6) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(7)~.tab__content:nth-of-type(7) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:checked:nth-of-type(8)~.tab__content:nth-of-type(8) {
|
||||
opacity: 1;
|
||||
transition: 0.5s opacity ease-in, 0.8s -webkit-transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease;
|
||||
transition: 0.5s opacity ease-in, 0.8s transform ease, 0.8s -webkit-transform ease;
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
-webkit-transform: translateY(0px);
|
||||
transform: translateY(0px);
|
||||
text-shadow: 0 0 0;
|
||||
}
|
||||
|
||||
.tab:first-of-type:not(:last-of-type)+label {
|
||||
border-top-right-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
||||
.tab:not(:first-of-type):not(:last-of-type)+label {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.tab:last-of-type:not(:first-of-type)+label {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
|
||||
.tab:checked+label {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
cursor: default;
|
||||
font-weight: bold;
|
||||
border: 1px solid #ddd;
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.tab:checked+label:hover {
|
||||
box-shadow: 0 -1px 0 #fff inset;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tab+label {
|
||||
box-shadow: 0 -1px 0 #eee inset;
|
||||
border-radius: 6px 6px 0 0;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: #27aae1;
|
||||
flex-grow: 3;
|
||||
text-align: center;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
transition: 0.3s background-color ease, 0.3s box-shadow ease;
|
||||
height: 50px;
|
||||
box-sizing: border-box;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.tab+label:hover {
|
||||
background-color: #f9f9f9;
|
||||
box-shadow: 0 1px 0 #f4f4f4 inset;
|
||||
}
|
||||
|
||||
.tab__content {
|
||||
padding: 2px 2px;
|
||||
background-color: transparent;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
left: 0;
|
||||
-webkit-transform: translateY(-3px);
|
||||
transform: translateY(-3px);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.tab__content pre {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.toolbar-icons {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
a.toolbar-icons {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.toolbar-icons .mdi {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.copy-msg {
|
||||
color: #4183c4;
|
||||
}
|
||||
|
||||
.pull-right {
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.pull-left {
|
||||
float: left !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook.js"></script>
|
||||
<script src="../gitbook/theme.js"></script>
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-search/search.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
|
||||
|
||||
|
||||
|
||||
<script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user