Wednesday, 13 November 2019
Tuesday, 12 November 2019
Add Swap memory to ec2 micro instance.
Remember one thing If ec2 instance memory is 1 GB then add 512 MB swap. It should be half of the instance memory.
To add this extra space to your instance you type:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
If you need more than 1024 then change that to something higher.
To enable it by default after reboot, add this line to /etc/fstab:
/var/swap.1 swap swap defaults 0 0
Set up mongodb and create user
$> sudo apt-get install -y mongodb
$> mongo
$> use admin
Please note: only change user and password not change to role and db
$> db.createUser({ user: "admin", pwd: "pwd@123", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] })
To check user auth
$> db.auth("admin", "hate2wait@123")
$> 1
create normal user
$> use db_production
$> db.createUser({ user: "myname", pwd: "anypassword", roles: [{ role: "dbOwner", db: "db_production" }] })
$> db.auth("myname", "anypassword")
$>
$> sudo nano /etc/mongodb.conf
# Turn on/off security. Off is currently the default
#noauth = true
auth = true
Uncomment auth = true
ctrl + x
Friday, 8 November 2019
Change Id to uuid in rails postgresql
Before run this command if you have migration file in migrate folder please take backup all migration file then run this command and migrate it will work.
rails g migration enable_uuid_extension
endclass EnableUuidExtension < ActiveRecord::Migration
def change
enable_extension "uuid-ossp"
enable_extension "pgcrypto"
end
end
Subscribe to:
Posts (Atom)
Revert last commit or second last and more....
Git revert commit_id -m 1 this command willl revert last commit Git revert commit_id -m 2 this command will revert second commit with same...
-
1. step : <script type="text/javascript"> window.onload = function(){ //Check File API support if(...
-
def time[A](f: => A) = { val s = System.nanoTime val ret = f println("time: " + (System.nanoTime - s) / 1e9 + ...
-
1. Add gem "aws-sdk-s3" and bundle install require 'aws-sdk-s3' # AWS S3 bucket upload method def self.upload...