<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>InfluxDB &#8211; IoT Expert</title>
	<atom:link href="https://iotexpert.com/category/tools/influxdb/feed/" rel="self" type="application/rss+xml" />
	<link>https://iotexpert.com</link>
	<description>Engineering for the Internet of Things</description>
	<lastBuildDate>Mon, 07 Jun 2021 15:20:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://iotexpert.com/wp-content/uploads/2017/01/cropped-Avatar-32x32.jpg</url>
	<title>InfluxDB &#8211; IoT Expert</title>
	<link>https://iotexpert.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Influx DB CLI Making Me Crazy</title>
		<link>https://iotexpert.com/influx-db-cli-making-me-crazy/</link>
					<comments>https://iotexpert.com/influx-db-cli-making-me-crazy/#respond</comments>
		
		<dc:creator><![CDATA[Alan Hawse]]></dc:creator>
		<pubDate>Mon, 31 May 2021 12:00:28 +0000</pubDate>
				<category><![CDATA[InfluxDB]]></category>
		<guid isPermaLink="false">https://iotexpert.com/?p=11210</guid>

					<description><![CDATA[Summary A solution to the Influx DB CLI error &#8220;Failed to check token: received status code 401 from server&#8221; including instructions to install the InfluxDB V2 CLI. Story As I worked my way through using the Influx Database I tried using the InfluxDB CLI.  However, no matter what I seemed to do I got this [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Summary</h1>
<p>A solution to the Influx DB CLI error &#8220;Failed to check token: received status code 401 from server&#8221; including instructions to install the InfluxDB V2 CLI.</p>
<h1>Story</h1>
<p>As I worked my way through using the Influx Database I tried using the InfluxDB CLI.  However, no matter what I seemed to do I got this error, which was super annoying.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ 
linux$ influx
Failed to check token: received status code 401 from server
linux$ influx create
Failed to check token: received status code 401 from server
linux$ influx adsf
Failed to check token: received status code 401 from server
linux$ influx setup
Failed to check token: received status code 401 from server</pre>
<p>I tried googling around to try to figure out what was happening but really didn&#8217;t see anything that would explain that behavior.  However, I did find one comment that if you were using Docker you could run the CLI by running in the shell.  So I tried that:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ docker exec -it 89ffd4bb9ec5  /bin/bash
root@89ffd4bb9ec5:/# influx version
Influx CLI 2.0.4 (git: 4e7a59bb9a) build_date: 2021-02-08T17:47:02Z</pre>
<p>When I originally installed the client (on Ubuntu) I did this:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ sudo apt install influxdb-client
[sudo] password for arh: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-hwe-5.4-headers-5.4.0-71
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  influxdb-client
0 upgraded, 1 newly installed, 0 to remove and 97 not upgraded.
Need to get 1,146 kB of archives.
After this operation, 3,969 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 influxdb-client amd64 1.1.1+dfsg1-4 [1,146 kB]
Fetched 1,146 kB in 1s (1,883 kB/s)       
Selecting previously unselected package influxdb-client.
(Reading database ... 275845 files and directories currently installed.)
Preparing to unpack .../influxdb-client_1.1.1+dfsg1-4_amd64.deb ...
Unpacking influxdb-client (1.1.1+dfsg1-4) ...
Setting up influxdb-client (1.1.1+dfsg1-4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...</pre>
<p>When I ran the version look what I got:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ /usr/bin/influx -version
InfluxDB shell version: 1.1.1</pre>
<p>Now we know the problem.  I have the wrong version of the CLI.  This was caused by two things</p>
<ol>
<li>I installed the docker version of InfluxDB.  So I never had the command line version on my linux box.</li>
<li>The influxdb-client that you get from whatever the debian source on Ubuntu is the 1.xx version.  It is too bad that you can&#8217;t &#8220;sudo apt install influxdbv2-client&#8221;  Oh well.</li>
</ol>
<p>To fix this start by nuking the old version.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ sudo apt-get remove influxdb-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  linux-hwe-5.4-headers-5.4.0-71
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  influxdb-client
0 upgraded, 0 newly installed, 1 to remove and 97 not upgraded.
After this operation, 3,969 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 275851 files and directories currently installed.)
Removing influxdb-client (1.1.1+dfsg1-4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...</pre>
<p>Then download the &#8220;InfluxDB Cloud CLI&#8221; (which is just a standalone version of the CLI.  You can get it from the influxdata.com website <a href="https://portal.influxdata.com/downloads/">here</a>.</p>
<p><a href="https://iotexpert.com/influx-db-cli-making-me-crazy/screen-shot-2021-05-21-at-11-14-25-am/" rel="attachment wp-att-11211"><img fetchpriority="high" decoding="async" src="https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-1024x455.jpg" alt="" width="1024" height="455" class="alignnone size-large wp-image-11211" srcset="https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-1024x455.jpg 1024w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-300x133.jpg 300w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-768x342.jpg 768w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-1536x683.jpg 1536w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-2048x911.jpg 2048w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.25-AM-600x267.jpg 600w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Scroll down to the InfluxDB Cloud CLI</p>
<p><a href="https://iotexpert.com/influx-db-cli-making-me-crazy/screen-shot-2021-05-21-at-11-14-38-am/" rel="attachment wp-att-11212"><img decoding="async" src="https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-1024x328.png" alt="" width="1024" height="328" class="alignnone size-large wp-image-11212" srcset="https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-1024x328.png 1024w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-300x96.png 300w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-768x246.png 768w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-1536x491.png 1536w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-2048x655.png 2048w, https://iotexpert.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-11.14.38-AM-600x192.png 600w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Then follow the instructions (Notice that I moved it to /usr/local/bin)</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.0.6-linux-amd64.tar.gz
--2021-05-21 11:08:48--  https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.0.6-linux-amd64.tar.gz
Resolving dl.influxdata.com (dl.influxdata.com)... 13.33.74.100, 13.33.74.21, 13.33.74.27, ...
Connecting to dl.influxdata.com (dl.influxdata.com)|13.33.74.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11758006 (11M) [application/x-gzip]
Saving to: ‘influxdb2-client-2.0.6-linux-amd64.tar.gz’

influxdb2-client-2.0.6-linux-amd64.tar.gz              100%[===========================================================================================================================&gt;]  11.21M  10.8MB/s    in 1.0s    

2021-05-21 11:08:50 (10.8 MB/s) - ‘influxdb2-client-2.0.6-linux-amd64.tar.gz’ saved [11758006/11758006]

linux$ tar xvf influxdb2-client-2.0.6-linux-amd64.tar.gz 
influxdb2-client-2.0.6-linux-amd64/LICENSE
influxdb2-client-2.0.6-linux-amd64/README.md
influxdb2-client-2.0.6-linux-amd64/influx
linux$ sudo mv influxdb2-client-2.0.6-linux-amd64/influx /usr/local/bin
</pre>
<p>Now when you check the version, you are in the money</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">linux$ influx version
Influx CLI 2.0.6 (git: 4db98b4c9a) build_date: 2021-04-29T16:48:12Z</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://iotexpert.com/influx-db-cli-making-me-crazy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
