MANGODB Installation
1. Download MongoDB installation files, I installed the Windows 64-bit, download the address as follows:
Https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.6-signed.msi
2. Create a new MongoDB folder in E-disk (casually put, such as E:mongodb)
3. Unzip the downloaded installation files and move the extracted files to e-disk MongoDB
4. Establishment of MONGODB data storage directory E:mongodbdata
5. Start MongoDB (simple start does not configure service)
E:mongodbbinmongod.exe--dbpath E:mongodbdata
You can see the following information:
Indicates that the installation started successfully.
6. Enter http://localhost:27017/in the browser and the following message appears, indicating that MONGDB has been activated.
It looks like your are trying to access MongoDB over HTTP on the native driver port.
7, download the corresponding MongoDB PHP plug-in (not too easy to find, if PHP is 5.4-5.5 version can be used this address: HTTP://PAN.BAIDU.COM/S/1SJJJSYH) and configured well.
8. Use in PHP:
The code is as follows |
|
try { $mongo = new MONGO (' localhost '); catch (Mongoconnectionexception $e) { Var_dump ($e); } $mongo _db = $mongo->selectdb (' logdatastorage '); |
Note: The code above is a demo and cannot be used in a production environment.
Memcache Installation
64-bit download
From: http://www.urielkatz.com/archive/detail/memcached-64-bit-windows/
Download: http://www.urielkatz.com/projects/memcached-win64/memcached-win64.zip
Source: http://www.urielkatz.com/projects/memcached-win64/memcached-src.rar
2. Decompress the compressed package you just downloaded to get two files: memcached.exe (the main program on the server) and pthreadGC2.dll
3. Run the command prompt with administrator privileges, navigate to the decompression path, and install the Memcached service. Command:
memcached.exe -d install
4. Execute Start → Administrative Tools → Services. Open the Windows Service Viewing Tool and find the memcached service.
5. Start Memcached:
memcached.exe -m 1024 -d start
-d for daemon startup, can not specify port default port 11211
-m is the specified memory size
6. Configure Windows firewall, add inbound rules for Memcached default port 11211 (if the server and client are on this machine, this step is not required)
7. Test whether it can communicate normally. Here we use Telnet:
telnet 127.0.0.1 11211
If you enter a blank doc screen, it is probably OK. The first line of command input is invisible, so I usually hit enter once and return an Error. It doesn't matter, it means that you entered an unrecognized command;
Then look at the status, type stats and press Enter:
8. Download the corresponding memcache php plugin (if PHP is version 5.5, this address is available: http://pan.baidu.com/s/1mgspf9e) and configure it.
9, connect and use in php:
$ memcache = new Memcache;
$ memcache-> connect ('127.0.0.1', 11211);
Mongodb installation configuration, startup and shutdown
1. Download the mongodb installation file. I installed windows 32-bit. The download address is as follows:
http://www.mongodb.org/dr//fastdl.mongodb.org/win32/mongodb-win32-i386-2.6.4.zip/download
2. Create a new mongodb folder on the E drive (put it anywhere)
E: mongodb
3. Unzip the downloaded file installation file and move the decompressed file to mongodb on the E disk
4. Establish mongodb data storage directory E: mongodbdata
5. Start mongodb (simple startup without configuration service)
E: mongodbbinmongod.exe --dbpath E: mongodbdata
E: mongodbbin> mongod.exe --dbpath E: mongodbdata
2014-09-13T22: 18: 50.640 + 0800
2014-09-13T22: 18: 50.640 + 0800 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2014-09-13T22: 18: 50.640 + 0800
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] MongoDB starting: pid = 9204 port = 27
017 dbpath = E: mongodbdata 32-bit host = 20120621-1418
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** 32 bit builds are limitedto less than 2GB of data (or less with --journal).
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** NOTE: your operating system version does not support the method that MongoDB
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** uses to detect impending page faults.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** This may result in slower performance for certain use cases
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] targetMinOS: Windows XP SP3
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] db version v2.6.4
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] build info: windows sys.getwindowsversion (major = 6, minor = 1, build = 7601, platform = 2, service_pack = 'Service Pack 1'BOOST_LIB_VERSION = 1_49
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] allocator: system
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] options: {storage: {dbPath: "E: mongodbdata"}}
Enter http: // localhost: 27017 / in the browser, it will appear that mongdb has been started
It looks like you are trying to access MongoDB over HTTP on the native driver port.
6. Connect to mongodb after startup
E: mongodbbinmongo.ext
E: mongodbbin> mongo
MongoDB shell version: 2.6.4
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Server has startup warnings:
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** 32 bit builds are limitedto less than 2GB of data (or less with --journal).
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** NOTE: your operating system version does not support the method that MongoDB
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** uses to detect impending page faults.
2014-09-13T22: 18: 50.765 + 0800 [initandlisten] ** This may result in slower performance for certain use cases
2014-09-13T22: 18: 50.765 + 0800 [initandlisten]
>
Mongodb shutdown:
Run in the foreground:
If --fork is not used, you can exit the terminal and close it directly. In this way, Mongodb will clean up and exit by itself, finish writing the unwritten data, and finally close the data file. Note that this process continues until all operations are completed.
Background process:
If you use --fork to run the mongdb service in the background, you must shut it down by sending a shutdownServer () message to the server.
1. Common commands:
$ ./mongod
> use admin
> db.shutdownServer ()
> db.shutdownServer ()
2014-09-13T22: 25: 07.843 + 0800 DBClientCursor :: init call () failed
server should be down ...
2014-09-13T22: 25: 07.890 + 0800 trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2014-09-13T22: 25