Hyperledger Explorer - hyperledger

I have installed all prerequisites for setting up the hyperledger Explorer but when I start it, I got the following error in log file:
And my config.json file is this:
Postgres' command also done:
1: https://i.stack.imgur.com/eTpSY.png
2: https://i.stack.imgur.com/IocQU.png

You're database setup is not done correctly, run these commands one by one.
Database setup
Connect to PostgreSQL database
sudo -u postgres psql
Run create database script
\i app/db/explorerpg.sql
\i app/db/updatepg.sql
Run db status commands.
\l view created fabricexplorer database
\d view created tables

Actually it postgres database error ...
In your error its clearly said that the chaincode_id doesnt exit ... so this is the problem .
if you want check what column are existed in the transaction table just follow below step
cd blockchain-explorer/app/persistence/postgreSQL/db
sudo -u postgres psql
\d transactions
check the corresponding column chaincode_id exist or not (it wont exist now ,Thats why you got this error)....
Solution for this type error
If you got any error like this first just go to the blockchain-explorer/app/persistence/postgreSQL/db directory
There you can see two file explorerpg.sql and updatepg.sql open this two file and check the corresponding column if existed on any of this file or not. If not you better to download explorer another version which contain the corresponding columns either of this two file mentioned above.
if existed just run below command on ubuntu
cd blockchain-explorer/app/persistence/postgreSQL/db
sudo -u postgres psql
\i explorerpg.sql
\i updatepg.sql
Once done this command just check the column "chaincode_id " is created or not by
\d transactions
it will list all column just check it on.
if the chaincode_id is exist run the explorer again ....

Related

How to take dump of neo4j graph databases?

I had my all databases stored at a location C:\JATIN DATA\database\neo4jDatabases. How can I take the dump of all databases individually using neo4j Dekstop.
I had already tried neo4j-admin dump --database= --to= this command but getting errors like Neo.ClientError.Statement.SyntaxError: Invalid input 'n': expected (line 1, column 1 (offset: 0))
"neo4j-admin dump --database= --to="
^
neo4j-admin must be run from a terminal command line -- not from the neo4j Browser.
Since you are using the Desktop, you can open a terminal window to the appropriate directory by selecting your neo4j Project from the Projects panel on the left, click the Manage button of the database you want to dump, And then select the Terminal tab.
Once in the Terminal window, you can enter a command like the one suggested by #logisma:
bin/neo4j-admin dump --database=graph.db --to=c:\
Thanks #cybersam and #logisima finally dump is taken successfully. This is the complete command .\bin\neo4j-admin.bat dump --database=graph.db --to=c:\dump\article_citation_graph.dump there was some admin privilege error.
Have you try this : .\bin\neo4j-admin.bat dump --database=graph.db --to=c:\
This should create a file named graph.db.dump in your c:\ folder.

I need to restore db from dump and cannot do it

I have a database dump at D:/backup.dump. I try to restore my database min_ro: I open psql.exe plugin. There are words
min_ro=#
Then I write restore command:
min_ro=# psql min_ro < D:/backup.dump
Then happens nothing. My database is not restored. What is wrong? It's first time using psql.
Update. I don't need psql only - I need to restore db from dump and cannot do it.
psql is not a SQL statement, so it doesn't make sense to enter that at the psql prompt which is there to run SQL statements (or psql meta commands).
c:\> psql min_ro < D:/backup.dump
needs to be entered on the (Windows) command line, not inside psql.
You can however just run the SQL script (which I assume your dump is) by using the \i ("include") meta command in `psql``
c:\> psql min_ro
min_ro=# \i D:/backup.dump
When you restore your database at pgAdminIII (by right-click at database name then choice 'restore') you can't see .dump files at backup list by default. That was my mistake forced me to try another ways to restore DB from dump.
But if you simply change file types to 'All files' you can restore your database from dump as usially.

postgres 'psql' command is not recognized in windows environment

It seems like I have it set up, I have my database.yml using postgres, and I can connect the database with pgadmin III, but when I tried using the psql command to test what version, it says that is is not recognized? Any idea what I should be doing?
I'm using windows and using command prompt with Ruby on Rails. Using PostgreSQL 9.2 installed with the EnterpriseDB one-click installer.
Assuming you installed PostgreSQL on Windows with the PostgreSQL "One-click" installer packaged by EnterpriseDB, psql is not added to the PATH automatically. That's partly because adding it to the path could otherwise cause confusion when people have multiple versions of PostgreSQL installed.
You need to specify the full explicit path to psql, eg:
"%PROGRAMFILES%\Postgresql\9.2\bin\psql.exe"
or add psql to the user PATH environment variable, see eg this guide.
Open Command Line
psql --version
if on above line psql version is not displayed, then follow below steps
(For Windows 7 OS)
Mycomputer->Properties->Advanced System Settings->EnvironmentVariables->Path->Edit->
(Donot remove any existing Path)
Add this
;C:\Program Files\PostgreSQL\9.5\bin;C:\Program Files\PostgreSQL\9.5\lib
save it then
Reopen Command Prompt and repeat
psql --version
C:\Users\rumi>psql --version
psql (PostgreSQL) 9.5.0
it is because there should not be space between the ; and your psql path so it should be like *****;C:\Program Files\PostgreSQL\9.2\bin\.
If there is a space after ******; then it will not work. You can actually type %PATH%in your cmd prompt and see how your environment variable and space looks like. I tried both cases for you, the first with space had the same error you mentioned and the second without space worked.
You need to set both the bin AND the lib path in your PATH environment variable separated by semicolons:
%PROGRAMFILES%\Postgresql\9.2\bin;%PROGRAMFILES%\Postgresql\9.2\lib

Postgresql fails to be recognised on the correct path

I'm trying to setup a new app with postgresql so I can deploy with Heroku. However, when I run the app using 'rails server' my welcome to rails screen gives this error:
PG::Error
could not connect to server: Permission denied Is the server running
locally and accepting connections on Unix domain socket
"/var/pgsql_socket/.s.PGSQL.5432"?
I'm sure this is the same issue as is covered here:
Repairing Postgresql after upgrading to OSX 10.7 Lion
But the fix by John Wang doesn't work.
I've tried adding 'export PATH=/usr/local/bin:$PATH' to the .bash_profile, .bashrc and .zshrc, none of which change the outcome. Calling which psql always returns /usr/bin/psql.
What am I doing wrong here? Any help would be much appreciated!
edit
Running /usr/local/bin/psql gives the same error and running echo $PATH gives:
/opt/local/bin:/opt/local/sbin:/Users/dave/.rvm/gems/ruby-1.9.3-p194/bin:/Users/dave/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/dave/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/dave/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/dave/.rvm/bin
What happens if you run your locally installed psql directly?
/usr/local/bin/psql ...
If that works then it's the path you need to change. You can just try running the export in a terminal, then which psql. If that doesn't pick up the right psql then check the export worked with
echo $PATH
I'm not sure which .xxrc file you'll need to update then - not got a mac to hand I'm afraid, but at least you'll know the command will work.
Oh - I keep several different versions of PostgreSQL around and find it useful to have some aliases set up:
alias psql90='/usr/local/pgsql90/bin/psql -p 5490'
alias psql84='/usr/local/pgsql84/bin/psql -p 5484'
alias pg_dump90=...
Your $PATH is just a list of directories to check separated by ":". It starts /opt/local/bin rather than /usr/local/bin and if you look further along you'll see /usr/bin coming before /usr/local/bin. So - we need to do two things:
Find out which psql we actually want
Make sure we can edit our PATH
Firstly - find your postgresql.conf file and check what port you are running on. There are three items of interest: listen_addresses, port and unix_socket_directory. Then we'll see if there's a socket there.
ls -a <your unix_socket_directory>
You should see a "file" something like ".s.PGSQL.5432" where the 5432 is the port number from your config file. If there's no such file, it's not running and it's time to get it running. You may need to change the port number in the config file if it matches Apple's existing usage.
Then find what psql installations exist
find /usr -type f -name psql
find /opt -type f -name psql
Try and figure out which one you need, perhaps add --version to help.
Then, let's see about editing your PATH. You must have some changes in your settings file anyway, so let's see if we can find where that setting is.
grep -l 'local/bin' ~/.*rc
That should list filenames containing local/bin - have a look and see if they are editing your PATH.

How to dump data from mysql database to postgresql database?

I have done the depot application using mysql... Now i am in need to use postgres... So i need to dump data from mysql database "depot_development" to postgres database "depot_develop"...
Here you can find some interesting links http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#MySQL
Have you tried to copy the tables from one database to the other:
a) export the data from MySQL as a CSV file like:
$> mysql -e "SELECT * FROM table" -h HOST -u USER -p PWD -D DB > /file/path.csv'
and then,
b) import it into Postgres like:
COPY table FROM '/file/path.csv' WITH CSV;
This question is a little old but a few days ago i was dealing with this situation and found pgloader.io.
This is by far the easiest way of doing it, you need to install it, and then run a simple lisp script (script.lips) with the following 3 lines:
/* content of the script.lisp */
LOAD DATABASE
FROM mysql://dbuser#localhost/dbname
INTO postgresql://dbuser#localhost/dbname;
/*run this in the terminal*/
pgload sctipt.lisp
And after that your postgresql DB will have all of the information that you had in your MySQL SB
On a side note, make you you compile pgloader since at the time of this post, the installer has a bug. (version 3.2.0)

Resources