command line interface – InfluxDB 2.0 | Backup results in `read:dbrp is unauthorized`. How to migrate bucket data?

We are running an InfluxDB 2.0 instance in a docker environment. For some weeks we have collected data using telegraf and store them into a bucket. Now, we would like to do a backup of our data.

What we can do to save our data is to make a copy of /root/.influxdbv2/, but we prefere to use build-in features and be able to restore the data into another instance of InfluxDB 2.0. This is were the problems begin.

Influx version

$ influx version
Influx CLI 2.0.0-beta.13 (git: 86796ddf2d) build_date: 2020-07-09T12:15:08Z

Trying to do a backup

$ export INFLUX_TOKEN=<token of admin user>
$ influx bucket find --org myOrg
ID                      Name            Retention       Organization ID
05b89a36ffe01003        _monitoring     168h0m0s        05b89a36ffe01000
05b89a36ffe01002        _tasks          72h0m0s         05b89a36ffe01000
05b89a36ffe01001        myBucket        0s              05b89a36ffe01000

$ influx backup -p /backup/backup_$(date '+%Y-%m-%d_%H-%M')
Error: read:dbrp is unauthorized
See 'influx backup -h' for help

Searching for influx "Error: read:dbrp is unauthorized" would not find anything on the internet.

The only hint I got is from the documentation:

If you set up InfluxDB using v2.0.0-beta.1 or earlier, you cannot back up data. Root tokens created prior to v2.0.0-beta.2 do not have the necessary permissions. To succesfully use the backup tool, set up a new InfluxDB instance using v2.0.0-beta.2+.

I pretty sure we started with a later beta version, from march, but I cannot doublecheck this. However, I would like to find a solution to export our data.

Trying to add missing permissions

As it seemed we do not have the right permissions, I checked the permissions and wanted to try adding the missing permissions to my admin user, which obviously did not work.

Check current permissions

During the check for permissions, I can see, that my admin user token does not have any dbrp permissions. But when I generate a new token in the GUI via Generate -> All access token, then the new token seems to have the required permissions:

$ influx auth list
05f79912b4f73000        <token2>       myAdmin        05b89a36e7e01000        (... read:orgs/05b89a36ffe01000/dbrp write:orgs/05b89a36ffe01000/dbrp ...)

(I shortened the output)

Error on adding permissions

However, just in case I tried to add the permissions to my admin user anyway.

$ influx auth create --user myAdmin --org myOrg --read-dbrps
Error: Permission read:orgs/05b89a36ffe01000/dbrp is not allowed: read:orgs/05b89a36ffe01000/dbrp is unauthorized.

Trying the new created token

As we saw in the step above, the new token has dprp permissions. When I use this token for the backup, I receive another error message.

$ export INFLUX_TOKEN=<newToken>
$ influx backup -p /backup/backup_$(date '+%Y-%m-%d_%H-%M')
Error: read:authorizations is unauthorized
See 'influx backup -h' for help

Searching for this error, I find one similar issue, which references another.

After reading this, I tried to set my token via the credentials file. But that did not change anything.

Migrating data to a fresh InfluxDB 2.0 instance

When I spawn a fresh Docker container of InfluxDB 2.0, the influx backup command works as expected. So, in order to use the build-in commands, I would like to migrate the collected data from my bucket into another instance. Do you see any possibility or am I missing anything to make these commands work?

Thanks a lot.

PS: Oh, there is no influxdb tag, at all? And I do not have enough reputation to create that tag. I hope it’s the right q&a platform to ask my question?

command line – Import table data using multiple sql file in psql

Local Machine(l1):
Windows 10
psql

Remote Machine(R1):
linux
EDB(postgres)

On my local I have 1000+ sql script containing insert statement . psql is also installed locally .
I need to run this sql script from my local command prompt using psql client .
I can connect to remote db as psql -h hostnme -U username -p port DBName . For single file i know that it can be run like i f.sql . I also tried combining all sql file in one file on windows using command copy /b *.sql new.sql . But the new sql file size is 4 GB . Which is not easy to work with . Is there any way I can run those 1000+ sql script from psql without combining from command prompt ?

javascript – How to make make the ‘ng generate’ command generate component with pug files?

I have an Angular 9 project and I want to use pug files instead of HTML as by view templates. I have ng-cli-pug-loader and it works fine compiling app of components with the pug files. But when I use ng generate component it creates a component with a HTML view and the app cannot be longer compiled, I have to manually change the extension to pug.

How can I change it to have fresh components generateg with angular schematics have pug files?

command line – Combining two dual-mono wav files into one stereo wav file

Well, I have batch files for converting dual-mono files to mono, and two mono files to a stereo file but would rather do in in one step if possible. Here’s my present batch file:

/ffmpeg -i Track07_ST.wav -c:a pcm_s24le -ac 1 TRACK07.WAV
/ffmpeg -i Track08_ST.wav -c:a pcm_s24le -ac 1 TRACK08.WAV
ren Track08_ST.wav TRACK08_STo.wav
/ffmpeg -i Track07.wav -i Track08.wav -filter_complex “[0:a][1:a]join=inputs=2:channel_layout=stereo[a]” -map “[a]” -c:a pcm_s24le TRACK08_ST.WAV
del Track07.wav
del Track08.wav

Thanks!

postgresql – How to implement what “psql > d table1” command does, manually in C?

I’m writing a Postgresql server extension in C, it’s a server-side trigger function. I’m using the standard server side interface in C that Postgres offers:

#include <stdio.h>
#include <time.h>
#include "postgres.h"
#include "utils/rel.h"
#include "executor/spi.h"
#include "commands/trigger.h"
#include "utils/fmgrprotos.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

extern Datum trig_test(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(trig_test);

Datum trig_test(PG_FUNCTION_ARGS) {    
  // ........ 


  // TODO: 
  // 1) infer a table over which a trgger is being executed (is more or less clear how to)
  // 2) (!) archive the same result over that table
  // as psq would do via this: "d that_table" (how?)
  // 3) write the output into a variable or file (is clear how to)
}

My current task is to achieve the same result as the d <table1> does in C, inside of a trigger function. And more essentially I need the “indexes” part, including primary_key and also whether or not primary key is made of a single column or multiple ones, and which ones.

How can I do it?

Preferably, not strictly, without having to use SPI_exec() command because I figure that it might be slower than some other, more direct way.

Windows File Recovery – ‘winfr.exe’ is not recognized as an internal or external command, operable program or batch file

I just installed Windows File Recovery from the Store.

I’m running build 19041.329

And when I click on it, and enter the admin password, I get the error in the title.

How do I fix this?

PostgreSQL – pgAdmin 4 – COPY command not working with Schema

When trying to use the COPY command in pgAdmin 4 to copy a table from my database into a CSV file on disk

copy Administrative.REGIONS TO 'd:tempregions.csv' with csv header

I get the following error:

ERROR:  schema "administrative" does not exist
SQL state: 3F000

I’m using PostgreSQL 12.3 on a localhost (Win 10), and I have tried to use the same command on a public schema table and it worked fine. It didn’t work on any table from any schema I tested apart from the public one.

The same command works fine with any table in the public schema.

The schema name and table name are copied and pasted from the properties

Any clues?

Thanks in advance, Ahmed

catalina – Command + W has stopped working for python app

I’m working on a matplotlib Python application to draw graphs (MacOS Catalina 10.15.5). I was able to close the window using Command + W but recently that doesn’t seem to work. The shortcut works with other applications like Firefox or Finder. Any way I can fix this?

plotting – “Solve” command not giving the correct answer for plot of a potential function

I have this code with this function of a potential V

V(r_) := (1 - 2*M/r)*(1 + l^2/r^2)
valuesa = {En -> 0.98, l -> 4.3, M -> 1};
Plot({V(r) /. valuesa, En /. valuesa}, {r, 0, 150})

As you can see from the plot, V intersects the line at three points, and the last one should be around the zone of 90 in the x axis, to get those values, I need rdot (this definition is a physical requirement of my problem) and use Solve

rdot = Sqrt(En^2 - V(r0) ) /. valuesa
Solve(rdot == 0 /. valuesa, r0)

However the values for r0 it gives me are
{{r0 -> 2.80228}, {r0 -> 8.50063}, {r0 -> 39.2021}}
The first ones are correct, but the third is incorrect, and I don’t know why

bin/magento command giving uncaught exception – fatal error

I have SSH access to a Magento 2 store and attempting to unlock an admin user. I can’t run
bin/magento or php bin/magento in the folder of the magento instance. How can I get this command to work? I’m getting the following error:

Warning : Uncaught Exception: Warning: require(/home/{{siteName}}/public_html/setup/config/application.config.php): failed to open stream: No such file or directory in /home/{{siteName}}/public_html/vendor/magento/framework/Console/Cli.php on line 57 in /home/{{siteName}}/public_html/vendor/magento/framework/App/ErrorHandler.php:6

Stack trace:
#0 /home/{{siteName}}/public_html/vendor/magento/framework/Console/Cli.php(57): MagentoFrameworkAppErrorHandler->handler(2, 'require(/home/i...', '/home/{{siteName}}/...', 57, Array)
#1 /home/{siteName}}/public_html/vendor/magento/framework/Console/Cli.php(57): require()
#2 /home/{{siteName}}/public_html/bin/magento(22): MagentoFrameworkConsoleCli->__construct('Magento CLI')
#3 {main}
  thrown in /home/{{siteName}}/public_html/vendor/magento/framework/App/ErrorHandler.php on line 61

Fatal error: MagentoFrameworkConsoleCli::__construct(): Failed opening required '/home/{{siteName}}/public_html/setup/config/application.config.php' (include_path='/home/{{siteName}}/public_html/var/generation:/home/{{siteName}}/public_html/lib/internal:/home/{{siteName}}/public_html/vendor/magento/zendframework1/library:/home/{{siteName}}/public_html/vendor/phpunit/php-file-iterator:/home/{{siteName}}/public_html/vendor/phpunit/phpunit:/home/{{siteName}}/public_html/vendor/symfony/yaml:.:/usr/local/php73/pear') in /home/{{siteName}}/public_html/vendor/magento/framework/Console/Cli.php on line 57```

PHP 7.3.16