#!/bin/sh
echo ‘Check Gemfile…';
if diff path/file1 path/file2 >/dev/null ; then
echo ‘Same';
else
echo ‘Different';
fi
Month: April 2015
MongoDB restore DB from MMS backup on shard clusters with different IPs than original shard
When restore shards using MongoDB MMS backup files, if the new shard IP addresses are not the same as the IPs from where you do backup, MongoDB will raise the error “11002 exception: socket exception [CONNECT_ERROR] for
Solution: Open a shell to MongoDB config server(s) and update the shard cluster IP in config DB:
use config;
db.shards.find()
db.shards.update({_id: “shard_id”}, {$set: {“host”: “shard_id/new_ip:port”}} })
MongoDB error can’t add shard because a local database ‘test’ exists in another shard
Error: When add shard with sh.addShard(), if new shard contains a DB with the same name as in previously added shards, MongoDB can’t automatically merge them:
errmsg” : “can’t add shard server2:27017 because a local database ‘test’ exists in another shard000:server1:27017
Solutions: mongodump the data on new shard, then drop that database and addShard. After that you can import the dump data using mongorestore
PHP cURL error code 60 SSL certificate problem self signed certificate in certificate chain
Error: When using PHP curl_exec() to a site with https and self signed certificate (which should be likely a staging site, not a production site)
Error code 60 SSL certificate problem: self signed certificate in certificate chain
Solution:
Since it is staging environment, we can completely ignore the certificate verification:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
PHP cURL error code 7 failed to connect
Error code 7 (CURLE_COULDNT_CONNECT) when calling curl_exec()
$ch = curl_init("http://www.google.com");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data); // false
print(curl_error($ch)); // Failed to connect to www.google.com 80
print(curl_errno($ch)); // 7
Solution:
1. Check your internet connection
2. Check your firewall
3. Add your proxy if you are connecting through proxy:
$proxy = “192.168.1.1:8080″;
curl_setopt($ch, CURLOPT_PROXY, $proxy);
Extract tar gz without the parent folder
Use –strip 1
tar -xvf ZendFramework-1.7.2.tar.gz --strip 1
MongoDB Replica Set STARTUP2 error initial sync need a member to be primary or secondary to do our initial sync
Error: MongoDB replica set stuck in STARTUP2 status with no replica becoming PRIMARY
error initial sync need a member to be primary or secondary to do our initial sync
Cause: You accidentally delete the local.* files in MongoDB DB path on one or multiple but not all replicas
Solution: Stop all replicas, delete local.* on all replicas, and then start them and redo the rs.initiate() and rs.add() command from any replica member.
Centos Linux limit a shell download bandwidth
Use trickle
sudo yum install trickle
trickle -d-u bash
Install telnet client on Windows
- Open a command prompt window. Click Start, type cmd in the Start Search box, and then press ENTER.
- Type the following command:
pkgmgr /iu:"TelnetClient"