这个是官网:
www.memcached.org
打开,然后点击:
LiveJournal
这个公司,这个公司在发展过程中,
发现数据越来越大,于是他的下面的一个员工
实际上是他的一个子公司www.danga.com,就开发了memcached
这样一个软件.这个公司已经被收购了.
-------------------------
可以去看看:http://www.danga.com/
这个公司除了提供
Some of the software born at Danga:

memcached [contributing] Distributed caching. Hit your database less. Speed up your website.
MogileFS [contributing] Distributed (meta) file system. Spray files across cheap disks on your network. Pay less for storage. No proprietary on-disk file formats.
Perlbal [contributing] Sexy reverse proxy load balancer and webserver, full of tricks.
DJabberd [contributing] High-performance, low-overhead, everything-is-a-plugin extensible Jabber/XMPP server.
Gearman [contributing] Low-latency remote function execution. Run code remotely, in parallel, load balanced, in other languages, etc.
OpenID [contributing] Decentralized identity.

可以看到还有其他项目对吧.
----------------------------
好,咱们去
www.memcached.org
看看他的介绍:
What is Memcached?
Free & open source, high-performance, distributed memory object caching system,
1.1 memcached  是什么?
free & open source, high-performance, distributed memory object caching system
自由&开放源码, 高性能 ,分布式的内存对象缓存系统
由 livejounal 旗下的 danga 公司开发的老牌 nosql 应用.
------------------------------
1.2  什么是 NoSQL?
nosql,指的是非关系型的数据库。
关系型数据库是一行一行的存储对吧.

相对于传统关系型数据库的"行与列",NoSQL 的鲜明特点为 k-v 存储(memcached,redis),
或基于文档存储(mongodb)
注:
nosql -- not only sql , 不仅仅是关系型数据库,
显著特点: key-value 键值对存储,如 memcached, redis,
或基于文档存储 如,mongodb
--------------------------------
1.3  谁在用 memcached?
Facebook,赶集,新浪,搜虎等等..开心网等等
-----------------
memcached  基本使用
首先去下载:
去官网:
http://www.memcached.org/
可以看到提供的都是Linux版本的,需要大家在Linux环境
下编译,使用:
2.1 linux  下编译 memcached
2.1.1: 准备编译环境
在 linux 编译,需要 gcc,make,cmake,autoconf,libtool 等工具,
这几件工具, 以后还要编译 redis 等使用,所以请先装.
在 linux 系统联网后,用如下命令安装
#yum install gcc make cmake autoconf libtool
2.1.2:  编译 memcached
memcached 依赖于 libevent 库,因此我们需要先安装 libevent.
分别到 libevent.org 和 memcached.org 下载最新的 stable 版本(稳定版).
先编译 libevent ,再编译 memcached,
编译 memcached 时要指定 libevent 的路径.
过程如下: 假设源码在/usr/local/src 下, 安装在/usr/local 下
# tar zxvf libevent-2.0.21-stable.tar.gz
# cd libevent-2.0.21-stable
# ./configure --prefix=/usr/local/libevent
# 如果出错,读报错信息,查看原因,一般是缺少库
# make && make install
# tar zxvf memcached-1.4.5.tag.gz
# cd memcached-1.4.5
#./configure--prefix=/usr/local/memcached \
--with-libevent=/usr/local/libevent
# make && make install
注意: 在虚拟机下练习编译,一个容易碰到的问题---虚拟机的时间不对,
导致的 gcc 编译过程中,检测时间通不过,一直处于编译过程.
解决:
# date -s ‘yyyy-mm-dd hh:mm:ss’
# clock -w # 把时间写入 cmos
----------------------------------
好,这里咱们可以先使用二进制版本.
也就是windows下的版本对吧.

好,咱们可以在网上找到,windows版本,
memcached.exe
memcached-win64-1.4.4-14.zip
解压,找到memcached.exe,libgcc_s_sjlj-1.dll,
,pthreadGC2.dll直接放到一个比如:
E:\mem
文件夹下.
-------------------------------
好,看看如何使用:
打开cmd:
C:\Users\Administrator>e:

E:\>cd mem

E:\mem>dir
 驱动器 E 中的卷是 办公
 卷的序列号是 0007-2E19

E:\mem 的目录

2017/06/04 周日  18:13    <DIR>          .
2017/06/04 周日  18:13    <DIR>          ..
2009/12/17 周四  00:47           507,640 memcached.exe
               1 个文件        507,640 字节
               2 个目录 25,952,534,528 可用字节

E:\mem>memcached.exe -h

E:\mem>
查看帮助:
E:\mem>memcached.exe -h
memcached 1.4.4-14-g9c660c0
-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     UNIX socket path to listen on (disables network support)
-a <mask>     access mask for UNIX socket, in octal (default: 0700)
-l <ip_addr>  interface to listen on (default: INADDR_ANY, all addresses)
-s <file>     unix socket path to listen on (disables network support)
-a <mask>     access mask for unix socket, in octal (default 0700)
-l <ip_addr>  interface to listen on, default is INADDR_ANY
-d start          tell memcached to start
-d restart        tell running memcached to do a graceful restart
-d stop|shutdown  tell running memcached to shutdown
-d install        install memcached service
-d uninstall      uninstall memcached service
-r            maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num>      max memory to use for items in megabytes (default: 64 MB)
-M            return error on memory exhausted (rather than removing items)
-c <num>      max simultaneous connections (default: 1024)
-k            lock down all paged memory.  Note that there is a
              limit on how much memory you may lock.  Trying to
              allocate more than that would fail, so be sure you
              set the limit correctly for the user you started
              the daemon with (not for -u <username> user;
              under sh this is done with 'ulimit -S -l NUM_KB').
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)
-h            print this help and exit
-i            print memcached and libevent license
-P <file>     save PID in <file>, only used with -d option
-f <factor>   chunk size growth factor (default: 1.25)
-n <bytes>    minimum space allocated for key+value+flags (default: 48)
-L            Try to use large memory pages (if available). Increasing
              the memory page size could reduce the number of TLB misses
              and improve the performance. In order to get large pages
              from the OS, memcached will allocate the total item-cache
              in one large chunk.
-D <char>     Use <char> as the delimiter between key prefixes and IDs.
              This is used for per-prefix stats reporting. The default is
              ":" (colon). If this option is specified, stats collection
              is turned on automatically; if not, then it may be turned on
              by sending the "stats detail on" command to the server.
-t <num>      number of threads to use (default: 4)
-R            Maximum number of requests per event, limits the number of
              requests process for a given connection to prevent
              starvation (default: 20)
-C            Disable use of CAS
-b            Set the backlog queue limit (default: 1024)
-B            Binding protocol - one of ascii, binary, or auto (default)
-I            Override the size of each slab page. Adjusts max item size
              (default: 1mb, min: 1k, max: 128m)

E:\mem>
----------------------------------
介绍一下,各个参数的作用:
-p <num> tcp port number to listen on (default: 11211) 
// 监听的端口,默认是11211
-u <num> udp port number to listen on (default: 0, off)
-s <file> unix socket path to listen on (disables network support)
-a <mask> access mask for unix socket, in octal (default 0700)
-l <ip_addr> interface to listen on, default is indrr_any
-d start tell memcached to start
-d restart tell running memcached to do a graceful restart
-d stop|shutdown tell running memcached to shutdown
-d install install memcached service 
// 把 memcached 注册成服务

-d uninstall uninstall memcached service
-r maximize core file limit
-u <username> assume identity of <username> (only when run as root)
//-u在Linux的时候会用.windows的时候可以不用理会

-m <num> max memory to use for items in megabytes, default is 64
mb //分配给 memcached 的最大内存
-m return error on memory exhausted (rather than removing
items)
-c <num> max simultaneous connections, default is 1024 
// 最大的连接数,比如用php或java来
//连接,能连接多少啊..

-k lock down all paged memory. note that there is a
limit on how much memory you may lock. trying to
allocate more than that would fail, so be sure you
set the limit correctly for the user you started
the daemon with (not for -u <username> user;
under sh this is done with 'ulimit -s -l num_kb').
-v verbose (print errors/warnings while in event loop) //
输出错误信息
-vv very verbose (also print client commands/reponses) //
输出所有信息
-h print this help and exit
-i print memcached and libevent license
-b run a managed instanced (mnemonic: buckets)
-p <file> save pid in <file>, only used with -d option
-f <factor> chunk size growth factor, default 1.25 
//增长因子这个讲到存储原理的时候再说.

-n <bytes> minimum space allocated for key+value+flags, default 48
--------------------
然后启动:
在 win 下启动
>memcached -m 64 -p 11211 -vvv
分64m内存,走11211端口,然后输出所有信息
-------------------------------------------------

举个例子:
怎么以最快的速度查询学生的成绩.

getFen.php
<?php
  //1. 可以直接查询数据库
  //2. 使用真静态---把对应的学生成绩
  //   放在磁盘上的html页面中
  //3. 直接操作内存
  //第一次我访问数据库,然后讲该学员的成绩
  //直接放入memached
------------------------------
memcached服务维护了一张内存表(hahstable)
key    value
100     90

memcached 的 key一般是 字串, 不能重复
value可以放入(字符串,数值,数组,对象,布尔,
二进制数据[图片/视频])
---------------------------------------
mysql的内存表,mysql可以把表存在内存中

可以把频繁变化的数据,但是丢了也无所谓的
数据放到内存中.

内存表就是key value的,就是咱们说的hashtable
--------------------
介绍:
memcached是一种缓存技术, 他可以把你的数据放入内存,
从而通过内存访问提速,因为内存最快的, memcached技术的
主要目的提速,在memachec 中维护了一张大的hashtable表 ,该表是在内存,表的结构是
key    value
字串  (字串,数值,数组,对象,布尔,二进制数据,null)
-----------------------------------

总结安装过程:
 安装并使用memcached
安装步骤
(1) 下载memcached软件
(2) 安装
进入cmd ,切换到 memcached.exe 文件所在目录
memcached.exe –d install
(3) 启动memcached
第一种,可以到服务点击启动
第二种, 命令行
memcached.exe –m 200MB –d start  
【-m的意思是以deamon方式启动,默认64M】

如果你在启动时,win7启动不成功, 则可以使用如下方法
memcached.exe –p 端口号

启动方法不要关闭控制台.

端口号的范围 : 0-65535  , 因为端口号是用两个字节来
表示有名端口: 0-1024 已经用程序使用 , apache 80  ,
mysql 3306 , ftp 21 , ssh 22
oracle: 1521, stmp: 25

使用netstat –an 如果看到 11211端口在监听,说明启动ok
netstat –anb 可以看这个端口是哪个程序监听, 这个指令
还可以看到有哪些用户连接到我们的服务器.

这样 netstat –anb 192.168.1.100
可以看到哪些电脑连接到了192.168.1.100
------------------------------------------
如果没有安装好,原因可能
1. 如果你是win7, win7对安全性高,所有,
必须以adminstartor 身份来安装.你切换成adminstrator , 
去安装,在启动
2.你的memcached.exe 目录有中文,或特殊字符, 保证目录
没有中文和特殊字符.
---------------------------------------------------

memcached高速缓存学习笔记001---memcached介绍和安装以及基本使用相关推荐

  1. memcached高速缓存学习笔记002---telnet操作memcached

    memcached高速缓存学习笔记002---telnet操作memcached 停止memcached  memcached.exe  -d stop 停止 memcached.exe -p 112 ...

  2. MongoDB学习笔记(一) MongoDB介绍及安装

    系列目录 MongoDB学习笔记(一) MongoDB介绍及安装     MongoDB学习笔记(二) 通过samus驱动实现基本数据操作     MongoDB学习笔记(三) 在MVC模式下通过Jq ...

  3. Typescript 学习笔记一:介绍、安装、编译

    前言 整理了一下 Typescript 的学习笔记,方便后期遗忘某个知识点的时候,快速回忆. 为了避免凌乱,用 gitbook 结合 marketdown 整理的. github地址是:ts-gitb ...

  4. MeayunDB学习笔记(一) MeayunDB介绍及安装

    系列目录 MeayunDB介绍-高性能分布式内存数据库 MeayunDB学习笔记(一)MeayunDB介绍及安装 MeayunDB学习笔记(二)批量导入数据 MeayunDB学习笔记(三)索引应用 一 ...

  5. memcached高速缓存学习笔记003---利用JAVA程序操作memcached crud操作

    memcache的Java客户端调用,在网上还是有些少,很多都是php的.如何要想用Java调用memcache的服务,首先要有客户端的支持,我们先下载一个客户端吧.下载地址:https://gith ...

  6. 【虚幻4/UE4】学习笔记01——软件介绍、安装及界面

    因为工作需要,一个完全零基础的小白开始学习UE4的征途开始啦~ 一.什么是UE4 UE4是一套为游戏开发者设计和构建优先.模拟和可视化的集成工具. 简言之,做游戏的软件. 二.UE4的功能 实时逼真渲 ...

  7. Hadoop学习笔记一 简要介绍

    Hadoop学习笔记一 简要介绍 这里先大致介绍一下Hadoop.     本文大部分内容都是从官网Hadoop上来的.其中有一篇介绍HDFS的pdf文档,里面对Hadoop介绍的比较全面了.我的这一 ...

  8. Ui学习笔记---EasyUI的介绍

    Ui学习笔记---EasyUI的介绍 -------------------------- 1.组织:   a.EasyUI官方:http://www.jeasyui.com     EasyUI是一 ...

  9. DataCamp的intermediate python学习笔记(001)

    DataCamp DataScientist系列之intermediate python的学习笔记(001) 个人感悟:接触python是从2017年1月开始的,中间的学习之路也是断断续续的,学了忘, ...

最新文章

  1. Android调试工具之ADB
  2. 大话数据结构04:循环链表
  3. sql server 自定义函数的使用
  4. Qt|设计模式工作笔记-对单例模式进一步的理解(静态加单例实现专门收发UDP对象)
  5. html的兼容有哪些,HTML里需要兼容验证的浏览器有哪些
  6. openstack中文文档
  7. keydown - keypress - keyup 用法和区别
  8. 面试官问:请拿出一段体现你水平的代码时,该如何回答?
  9. Java EE 导图
  10. RTL8187B无线网卡不能上网的解决办法
  11. 语音识别之语音数据预处理
  12. 软件评测师备考详细知识点
  13. 【OpenVP* 】Centos 部署OpenVP* 证书+多客户端+密码认证
  14. win7电脑变身WiFi热点,让手机、笔记本共享上网
  15. java填充word文档_如何使Word文档可填充但不可编辑
  16. 制作单词记录App(三)
  17. 如何从公网访问本地的Zeus?
  18. Python正则表达式中的re.S,re.M,re.I的作用
  19. qq软件下载2015正式版免费版v6.8官方版
  20. 使用Java实现alpha-beta剪枝算法(井字棋小游戏)

热门文章

  1. Pytorch:Tensor和Numpy
  2. 浅谈C++容器(转)
  3. tabpanel中autoload方法传递参数
  4. 【论文阅读】Multisource Transfer Learning With Convolutional Neural Networks for Lung Pattern Analysis
  5. spring之基本介绍以及老版本框架的下载地址
  6. Python文摘:Requests (Adavanced Usage)
  7. 记录最近业务中出现的两个问题
  8. 层层递进——宽度优先搜索(BFS)
  9. sql自动审核工具-inception
  10. 加快ALTER TABLE 操作速度