<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Admin API on Grafana Labs</title><link>https://grafana.com/docs/enterprise-metrics/v1.7.x/admin-api/</link><description>Recent content in Admin API on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/enterprise-metrics/v1.7.x/admin-api/index.xml" rel="self" type="application/rss+xml"/><item><title>Leadership Election</title><link>https://grafana.com/docs/enterprise-metrics/v1.7.x/admin-api/leadership-election/</link><pubDate>Mon, 17 Mar 2025 14:18:51 +0100</pubDate><guid>https://grafana.com/docs/enterprise-metrics/v1.7.x/admin-api/leadership-election/</guid><content><![CDATA[&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&#34;./&#34;&gt;admin API&lt;/a&gt; allows you to create and manage resources in your Grafana Enterprise
Metrics (GEM) cluster such as tenants, access policies, and tokens. When performing operations that modify
resources such as updates or deletes, the admin API requires the use of resource version numbers to make
sure the most recent version of resources are being operated on. An additional, optional, safety feature the
admin API can make use of to ensure concurrent modifications don&amp;rsquo;t overwrite each other is
&lt;a href=&#34;https://aws.amazon.com/builders-library/leader-election-in-distributed-systems/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;leadership election&lt;/a&gt;. This
allows admin API components to elect a single component to perform all modification requests, making sure that
simultaneous requests don&amp;rsquo;t overwrite each other. Details about how to use and configure this feature are
provided below.&lt;/p&gt;
&lt;h2 id=&#34;configuration&#34;&gt;Configuration&lt;/h2&gt;
&lt;p&gt;Leadership election is an optional, but recommended, feature of the GEM admin API. It can be enabled and
configured under the &lt;code&gt;admin_api&lt;/code&gt; section of the GEM &lt;a href=&#34;../../config/reference/#admin_api_config&#34;&gt;configuration file&lt;/a&gt;.
Leadership election uses the same mechanism as other GEM components to coordinate among themselves, the
&lt;a href=&#34;https://cortexmetrics.io/docs/architecture/#the-hash-ring&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;hash ring&lt;/a&gt;. This means you&amp;rsquo;ll need to configure
this instance of the ring the same way you configured the ring used by distributors and ingesters when
setting up your GEM cluster.&lt;/p&gt;
&lt;p&gt;An example of this configuration is provided below using the
&lt;a href=&#34;https://cortexmetrics.io/docs/guides/getting-started-with-gossiped-ring/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;memberlist gossip ring&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;admin_api:
  leader_election:
    enabled: true
    ring:
      kvstore:
        store: memberlist
      tokens_observe_period: 5s&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Note that any supported backend (Etcd, Consul, or memberlist) can be used for leader election with
the admin API, memberlist is only used as an example here. For simplicity, it is recommended to use whatever
ring backend you are already making use of for other GEM components.&lt;/p&gt;
&lt;h2 id=&#34;implementation&#34;&gt;Implementation&lt;/h2&gt;
&lt;p&gt;Admin API leadership election does not require a &lt;a href=&#34;https://en.wikipedia.org/wiki/Quorum_%28distributed_computing%29&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;quorum&lt;/a&gt; to operate like other uses of the ring
in GEM components. This means it is not required to run an odd number of admin API components. Instead, it
is sufficient to run two for redundancy.&lt;/p&gt;
]]></content><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>The &lt;a href="./">admin API&lt;/a> allows you to create and manage resources in your Grafana Enterprise
Metrics (GEM) cluster such as tenants, access policies, and tokens. When performing operations that modify
resources such as updates or deletes, the admin API requires the use of resource version numbers to make
sure the most recent version of resources are being operated on. An additional, optional, safety feature the
admin API can make use of to ensure concurrent modifications don&amp;rsquo;t overwrite each other is
&lt;a href="https://aws.amazon.com/builders-library/leader-election-in-distributed-systems/" target="_blank" rel="noopener noreferrer">leadership election&lt;/a>. This
allows admin API components to elect a single component to perform all modification requests, making sure that
simultaneous requests don&amp;rsquo;t overwrite each other. Details about how to use and configure this feature are
provided below.&lt;/p></description></item></channel></rss>