DynamoDB Local deletes data after shutting down instance - javascript

I'm using DynamoDB Local for my app, and it keeps deleting all the sample data every time I shut down the instance. Does anyone know why this happens?
I've tried to look it up, but I don't see anyone else has this issue.
I've used the downloadable version of dynamodb and use this command dynamodb_local_latest baopham$ java -Djava.library.path=./DynoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -inMemory to start and instance.
Am I missing anything? Thank you.

DynamoDB local usage documentation clearly states that if use -inMemory option, data will be in memory and data will be lost when you terminate. Take out -inMemory option in your command.
If you use the -inMemory option, DynamoDB does not write any database files at all. Instead, all data is written to memory, and the data is not saved when you terminate DynamoDB.

for docker, this command worked for me
docker run --name dynamodb -p 8000:8000 -d amazon/dynamodb-local -jar DynamoDBLocal.jar

Related

How to restart a Node.js project?

I'm not a Node.js developer. So I have no idea how it works. I've been a PHP developer for over 8 years.
Because of some reason, I need to make a small change in a Node.js project which is live. All I have to do is changing a payment gateway token. I did it like this:
After pulling it on the server, users still go to the old payment gateway. So I guess I need to do a restart. (I'm saying so because, for PHP projects, when you change a config-related thing, you need to restart PHP).
Not sure should I restart what thing? Noted that, the server is Ubuntu 20.04 and uses Nginx to talk to Node.js. In other word, how can I see Node is running as what service on Linux?
Also, there are two files that I think I need to run the project again after restarting Node through one of them: index.js, server.js. Am I right?
And
Your Node.js script likely runs under a process that restarts the script in case it dies. There are several "run forever" wrappers, the most popular one is pm2. Find out which one is used in your project. Try pm2 list as the user your project executes under. If pm2 type pm2 restart app_name to restart your project.
Please check if it is a node.js project so you can write the command node index.js or node server.js with this command you can start your node server.

Need to RUN SQL Stored Procedure from JavaScript

I'm testing the API from the Cypress tool. For my requirement I have connected to my SQL Server DB using coffeescript and tedious npm packages with the required settings. With that I'm also able to run the SQL queries like this...
cy.sqlServerDB2("SQL Query...")
But now I have got a 200 line SQL Script which have placed in the root directory as "CreatePhysicalData.sql".
Now my requirement is to run the "CreatePhysicalData.sql" script.
Can someone help me with it please.
Thanks

Git return "'pull' is not a git command. See 'git --help'" from remote on Windows 10

I have a bonobo server on my server that is running windows 10.
I'm trying to link a new hook on "Update", so the files from the node development server can get updated directly from git.
I tried to do so using a cmd file, examples to follow:
update file in hooks
cmd //C "start C:\webServer\node\testServer\update.bat"
update.bat on the same folder on testServer
set PATH=%PATH%;C:\Program Files\Git\cmd\git.exe
cd C://webServer/node/testServer
git pull
That was returning the following error:
git: 'pull' is not a git command. See 'git --help'
I did some research and found out this post "git pull" broken where they talk about using -exec-path on Mac, I tried to search the equivalent in Windows and found out some variables for path related issues, tried them an none of them worked, also tried to reinstall git without any other result, at that point I was tired of it and I tried to use a node library, simple-git, that allows me to do a pull request using node specifying the path! I tried it on the server, and it worked! (I will attach the code of the file below) so I thought to try it from the remote server, but then I got the same error again, pull is not a git command, I tried to call the node file in different ways, I tried some python script to run a cmd command that runs the node server, I tried using bat and sh files, even using node to run another instance of node, and nothing worked, it always returns pull is not a git command :/
Node simple-git code
require('simple-git')("C:\\webServer\\node\\testServer")
.pull(function(a,b){
console.log(a,b); //for debug
})
Has additional information, git is properly set up as an environmental variable and I can access it without problems from the server, this issue only happens when trying to execute the pull from the hooks!
If anyone can give me some tips on what to try that would be awesome, thanks!

How to call redis-cli from Grunt?

I'm trying to call redis-cli from Grunt. The reason is I want to be able to easily connect to the various instance or Redis we have without having to check or remember the connection details. E.g. I want to call grunt redis-cli:staging to run redis-cli against the Redis DB of our staging environment.
I had success calling other redis utility (i.e. redis-stat, redis-commander) using the grunt-run module. However, when I try with redis-cli it does not work.
I suspect it is due to the type of utility. redis-cli is a prompt to run redis commands while the others are just tools that does not expect user inputs.
Any idea how I could start redis-cli (ideally synchronously) from Grunt?
Thanks a lot!
Edit: Fixed typos and clarified question.
Could you just make a bash script
#!/bin/bash
redis-cli -h staging -p 1234
Name it dbstage then you run with ./dbstage

Can't connect to local mongoDB install

After downloading, extracting, creating the data/db folder and cd-ing into where I extracted mongoDB, I tried running this command, as directed by the official mongoDB install instructions: .bin/mongo/ but I keep getting this error:
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
I can't find a concise explanation on the internet, though it seems to be a common problem, and the mongoDB docs aren't clear either. Can anyone help me out?
Start the server before trying to connect with a client:
mongod
Or if you want to specifically point it at a db location, and log to a log file:
mongod --logpath /data/log/mongo.log --dbpath /data/db
Or something of this nature. This command will run the server in a foreground process. You can use --fork to daemonize it.

Categories