Restore backup in aerospike - backup

I am trying to restore a backup from aerospike and I get this error:
2016-01-26 21:55:47 GMT [INF] [20675] Starting restore to 127.0.0.1:3000 (bins: [all], sets: [all]) from backup.asb
2016-01-26 21:55:47 GMT [INF] [20675] Processing 1 node(s)
2016-01-26 21:55:47 GMT [INF] [20675] Restoring backup.asb
2016-01-26 21:55:47 GMT [INF] [20675] Opened backup file backup.asb
2016-01-26 21:55:47 GMT [ERR] [20675] Invalid version line in backup file backup.asb
2016-01-26 21:55:47 GMT [ERR] [20675] 0000 32 30 31 36 2d 30 31 2d 32 36 20 31 00 2016-01-26 1.
2016-01-26 21:55:47 GMT [ERR] [20675] Error while opening shared backup file
2016-01-26 21:55:48 GMT [INF] [20693] 0 UDF file(s), 0 secondary index(es), 0 record(s) (0 KiB/s, 0 rec/s, 0 B/rec, backed off: 0)
2016-01-26 21:55:48 GMT [INF] [20693] Expired 0 : skipped 0 : inserted 0 : failed 0 (existed 0, fresher 0)
How to fix this?
Both backup and restore servers have the same version of aerospike (Aerospike Community Edition build 3.7.2)
Here is the backup file first 42 lines:
2016-01-26 15:54:18 GMT [INF] [23418] Starting 100% backup of 127.0.0.1:3000 (namespace: test, set: [all], bins: [all]) to [stdout]
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:415][as_cluster_seed_nodes] Add node BB90600F00A0142 127.0.0.1:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:475][as_cluster_find_nodes_to_add] Duplicate node found BB90600F00A0142 127.0.0.1:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB91B00F00A0142 10.240.0.27:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB90500F00A0142 10.240.0.5:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB90D00F00A0142 10.240.0.13:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB90E00F00A0142 10.240.0.14:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB91700F00A0142 10.240.0.23:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:483][as_cluster_find_nodes_to_add] Add node BB91800F00A0142 10.240.0.24:3000
2016-01-26 15:54:18 GMT [INF] [23418] [src/main/aerospike/as_cluster.c:475][as_cluster_find_nodes_to_add] Duplicate node found BB90600F00A0142 127.0.0.1:3000
2016-01-26 15:54:18 GMT [INF] [23418] Processing 7 node(s)
2016-01-26 15:54:18 GMT [INF] [23418] Node ID Objects Replication
2016-01-26 15:54:18 GMT [INF] [23418] BB90600F00A0142 5897565 3
2016-01-26 15:54:18 GMT [INF] [23418] BB91B00F00A0142 5957713 3
2016-01-26 15:54:18 GMT [INF] [23418] BB90500F00A0142 5956161 3
2016-01-26 15:54:18 GMT [INF] [23418] BB90D00F00A0142 5955580 3
2016-01-26 15:54:18 GMT [INF] [23418] BB90E00F00A0142 5879393 3
2016-01-26 15:54:18 GMT [INF] [23418] BB91700F00A0142 5923271 3
2016-01-26 15:54:18 GMT [INF] [23418] BB91800F00A0142 5936997 3
2016-01-26 15:54:18 GMT [INF] [23418] Namespace contains 13835560 record(s)
2016-01-26 15:54:18 GMT [INF] [23453] Starting backup for node BB90600F00A0142
2016-01-26 15:54:18 GMT [INF] [23453] No secondary indexes
2016-01-26 15:54:18 GMT [INF] [23453] Backing up 0 UDF file(s)
Version 3.1
# namespace test
# first-file
+ k B 8 ADhSgg==
+ n test
+ d GmBtCbKAyOCJkFjeYld+6JOvLEU=
+ s linksd
+ g 1
+ t 0
+ b 1
- B value 8 AAibxA==
+ k B 8 AGJkEA==
+ n test
+ d GqDqbia17QaG5dEpmyBcTGv5JiI=
+ s index
+ g 133
+ t 0
+ b 1

First few lines, till the line you see "Version 3.1" is not valid backup.
....backup of 127.0.0.1:3000 (namespace: test, set: [all], bins:
[all]) to [stdout]
Based on the first line that you shared, seems you are using 'stdout' as your output filename. This will capture all the output of the backup command where it prints some runtime information also. This is confusing the restore comamnd as the backup file is not in expected format.
So, please do not redirect stdout to the backup file. If you want to capture the stdout of the backup command, you can redirect it to a file different than the backup file.

Related

how do you extract a variable that appears multiple times in a table only once

I'm trying to extract the name of space organisations from a table but the closest i can get is the amount of times it appears next to the name of the organisation but i just want the name of the organisation not the amount of times it is named in the table.
if you can help me please leave a comment on my google colab.
https://colab.research.google.com/drive/1m4zI4YGguQ5aWdDVyc7Bdpr-78KHdxhR?usp=sharing
What I get:
variable number
organisation
time of launch
0
SpaceX
Fri Aug 07, 2020 05:12 UTC
1
CASC
Thu Aug 06, 2020 04:01 UTC
2
SpaceX
Tue Aug 04, 2020 23:57 UTC
3
Roscosmos
Thu Jul 30, 2020 21:25 UTC
4
ULA
Thu Jul 30, 2020 11:50 UTC
...
...
...
4319
US Navy
Wed Feb 05, 1958 07:33 UTC
4320
AMBA
Sat Feb 01, 1958 03:48 UTC
4321
US Navy
Fri Dec 06, 1957 16:44 UTC
4322
RVSN USSR
Sun Nov 03, 1957 02:30 UTC
4323
RVSN USSR
Fri Oct 04, 1957 19:28 UTC
etc
etc
etc
What I want:
organisation
RVSN USSR
Arianespace
CASC
General Dynamics
NASA
VKS RF
US Air Force
ULA
Boeing
Martin Marietta
etc

Convert or cast varchar rows like (Mon Jul 18 19:28:36 EDT 2018) To DateTime

I have a column varchar type with dates like:
Fri Mar 3 12:55:17 EST 2017
Thu Jul 27 10:12:07 EDT 2017
Fri Jul 21 12:11:35 EDT 2017
Wed Jan 31 13:15:34 EST 2018
And I would like to return just the date and time something like:
03/03/2017 12:55:17
07/27/2017 10:12:07
07/21/2017 12:11:35
01/31/2018 13:15:34
I tried several ways with substring and convert statement but nothing work.
Any assistance in this regard will be greatly appreciated.
Perhaps something like this
Example
Declare #YourTable table (SomeCol varchar(50))
Insert Into #YourTable values
('Fri Mar 3 12:55:17 EST 2017'),
('Thu Jul 27 10:12:07 EDT 2017'),
('Fri Jul 21 12:11:35 EDT 2017'),
('Wed Jan 31 13:15:34 EST 2018')
Select *
,AsDateTime = try_convert(datetime,substring(SomeCol,4,len(SomeCol)-11)+right(SomeCol,4))
From #YourTable
Returns
SomeCol AsDateTime
Fri Mar 3 12:55:17 EST 2017 2017-03-03 12:55:17.000
Thu Jul 27 10:12:07 EDT 2017 2017-07-27 10:12:07.000
Fri Jul 21 12:11:35 EDT 2017 2017-07-21 12:11:35.000
Wed Jan 31 13:15:34 EST 2018 2018-01-31 13:15:34.000

presto sql: select the data that before or after a datetime

There is table called t1, and there are columns id, created_at, text, for example, as following table:
id created text
1 Thu Jun 30 01:00:57 +0000 2016 I like this movie1
2 Thu Jun 30 02:59:57 +0000 2016 I like this movie2
3 Thu Jun 30 03:49:57 +0000 2016 I like this movie3
4 Thu Jun 30 04:59:50 +0000 2016 I like this movie4
5 Thu Jun 30 05:39:57 +0000 2016 I like this movie5
6 Thu Jun 30 06:39:57 +0000 2016 I like this movie6
7 Thu Jun 30 06:29:57 +0000 2016 I like this movie6
8 Thu Jun 30 07:09:57 +0000 2016 I like this movie7
9 Thu Jun 30 07:39:57 +0000 2016 I like this movie8
10 Thu Jun 30 08:39:57 +0000 2016 I like this movie9
11 Thu Jun 30 09:39:57 +0000 2016 I like this movie10
12 Thu Jun 30 10:29:57 +0000 2016 I like this movie11
13 Thu Jun 30 11:29:57 +0000 2016 I like this movie12
12 Thu Jun 30 12:29:57 +0000 2016 I like this movie13
I want to select data separated by hour time.
For example, I want to select all the data that hour is less or equal 06, then I want to select the data that hour is more than 07. Since the data of column is datetime form: Thu Jun 30 12:29:57 +0000 2016, I don't know how to deal with this. Thanks for your help!
The sql is presto(presto sql):
select id, created, text from t1 where created_at <= 6
You could use datepart for this if you are using mssql:
select
id,
created,
text
from
t1
where
datepart(hour, created) <= 6
References:
DATEPART (Transact-SQL)
I done it, use the hour(datestamp)can solve it.
select id, created, text from t1 where hour(created_at) <= 6

OSX: Obj-C: how to get user last login and logout time of the user?

I need to fetch the last login and logout time of the user using objective-c. Is it possible?
I am able to see the whole record manually by viewing the following file
/private/var/log/accountpolicy.log
Even if I read the file from code and parse it but there are chances that user does not have the permission to access the file and so the app.
P.S: Can not ask user for right elevation window as I am doing it in background proecess.
Check the last command.
https://www.freebsd.org/cgi/man.cgi?query=last&sektion=1
LAST(1) FreeBSD General Commands Manual LAST(1)
NAME
last -- indicate last logins of users and ttys
SYNOPSIS
last [-swy] [-d [[CC]YY][MMDD]hhmm[.SS]] [-f file] [-h host] [-n maxrec] [-t tty] [user ...]
ex:
$ last
gbuzogany ttys001 Fri Mar 18 11:21 - 11:27 (00:06)
gbuzogany ttys003 Fri Mar 18 10:24 - 11:18 (00:54)
gbuzogany ttys003 Fri Mar 18 10:07 - 10:07 (00:00)
gbuzogany ttys002 Fri Mar 18 10:03 - 11:18 (01:15)
gbuzogany ttys001 Fri Mar 18 10:01 - 10:30 (00:29)
gbuzogany ttys001 Fri Mar 18 09:31 - 09:33 (00:01)
gbuzogany ttys004 Thu Mar 17 15:34 - 15:52 (00:18)
...

How to get date-format with day + month name and GMT?

I want to write the current date in the following format in VB.net:
Tue, 27 Jul 2010 00:00:00 GMT+02:00
Any help would be appreciated.
Perhaps simply:
Date.Now.ToString("R") ' Fri, 14 Nov 2014 12:32:18 GMT
The RFC1123 ("R", "r") Format Specifier