• memcache搭建


    memcache搭建步骤:

    个人原创,允许转载,请注明出处,作者,否则追究法律责任。


    0.1 memcache的服务端
    0.2 mysql的服务端
    0.3 memcache 的客户端:lamp架构

    1,环境搭建:
    memcache的安装包
    if地址
    yum源
    三关
    yum - y install gcc*

    2,先配置0.3上的lamp架构:

    yum -y install httpd mysql-server mysql
    82 service httpd restart
    83 cd /root/桌面/
    84 ls
    85 cp memcache.zip /tmp
    86 cd /tmp/
    87 ls
    88 unzip memcache.zip
    89 ls
    90 cd memcache
    91 ls
    94 cp memcache-2.2.7.tgz /usr/src/
    95 scp memcached-1.4.22.tar.gz libevent-2.0.22-stable.tar.gz root@10.0.0.1:/tmp
    96 ls
    97 cd php/
    98 ls
    99 rm -rf php-devel-5.3.2-6.el6.x86_64.rpm
    100 rm -rf php-devel-5.3.3-23.el6_4.x86_64.rpm
    101 ls
    102 cd /usr/src/
    103 ls
    108 tar fx memcache-2.2.7.tgz
    109 ls
    110 cd memcache-2.2.7
    111 ls
    112 cd -
    113 ls
    114 cd /tmp/memcache/php/
    115 ls
    117 yum -y localinstall ./*
    118 yum -y localinstall --skip-broken ./*
    119 cd /usr/src/
    120 ls
    121 cd memcache-2.2.7
    122 phpize
    123 ls
    124 ./configure --enable-memcache --with-php-config=/usr/bin/php-config
    125 make
    126 make install
    127 ls /usr/lib64/php/modules/
    128 vim /etc/php.ini
    末行添加:extension=memcache.so
    129 php -m   (检查下有没有memcache的模块:memcache.so)

    3,配置0.1上的memcache的服务端

    cd /tmp
    54 ls
    55 tar fx libevent-2.0.22-stable.tar.gz
    56 ls
    57 cd libevent-2.0.22-stable
    58 ls
    59 ./configure --prefix=/usr/local/libevent
    81 make && make install
    82 cd ..
    83 ls
    84 tar fx memcached-1.4.22.tar.gz
    85 ls
    86 cd memcached-1.4.22
    87 ls
    88 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent
    89 make
    91 make install
    92 /usr/local/memcached/bin/memcached -u root -p 11211 -l 10.0.0.1 -P /var/run/messagebus.pid -m 128m -c 2048 -d  (启动memcache)

    [root@localhost memcached-1.4.22]# /usr/local/memcached/bin/memcached -u root -p 11211 -l 10.0.0.1 -P /var/run/messagebus.pid -m 128m -c 2048 -d
    [root@localhost memcached-1.4.22]# yum -y install lsof
    已加载插件:product-id, refresh-packagekit, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    设置安装进程
    包 lsof-4.82-5.el6.x86_64 已安装并且是最新版本
    无须任何处理
    [root@localhost memcached-1.4.22]# lsof -i :11211
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    memcached 14715 root 26u IPv4 43374 0t0 TCP 10.0.0.1:memcache (LISTEN)
    memcached 14715 root 27u IPv4 43376 0t0 UDP 10.0.0.1:memcache
    memcached 14715 root 28u IPv4 43376 0t0 UDP 10.0.0.1:memcache
    memcached 14715 root 29u IPv4 43376 0t0 UDP 10.0.0.1:memcache
    memcached 14715 root 30u IPv4 43376 0t0 UDP 10.0.0.1:memcache

    [root@localhost memcached-1.4.22]# ps aux |grep memcache
    root 14715 0.0 0.2 326916 1140 ? Ssl 14:59 0:00 /usr/local/memcached/bin/memcached -u root -p 11211 -l 10.0.0.1 -P /var/run/messagebus.pid -m 128m -c 2048 -d
    root 14728 0.0 0.1 103324 876 pts/0 S+ 14:59 0:00 grep memcache
    [root@localhost memcached-1.4.22]# yum -y install telnet
    [root@localhost memcached-1.4.22]# telnet 10.0.0.3 80
    Trying 10.0.0.3...
    Connected to 10.0.0.3.
    Escape character is '^]'.
    set name 0 60 5
    vfast
    STORED
    get name

    stats

    4,0.2 安装MySQL服务端

    yum -y intall mysql mysql-server
    [root@localhost yum.repos.d]# service mysqld start

    [root@localhost yum.repos.d]# mysql
    ...
    mysql> grant all on *.* to root@'%' identified by '123';
    Query OK, 0 rows affected (0.00 sec)

    mysql> select user,password,host from mysql.user;
    +------+-------------------------------------------+-----------------------+
    | user | password | host |
    +------+-------------------------------------------+-----------------------+
    | root | | localhost |
    | root | | localhost.localdomain |
    | root | | 127.0.0.1 |
    | | | localhost |
    | | | localhost.localdomain |
    | root | *23AE809DDACAF96AF0FD78ED04B6A265E05AA257 | % |
    +------+-------------------------------------------+-----------------------+
    6 rows in set (0.00 sec)

    mysql> exit

  • 相关阅读:
    一个好用的H5tab切换(抽屉功能)
    jQuery的ajax请求
    原生js的ajax请求
    微信小程序封装get、post请求
    微信小程序 data数据的赋值和取值
    gitLab更新文件命令
    vue中localStorage的使用
    linux就该这么学--课程第15天
    linux就该这么学--课程第14天
    linux就该这么学--课程第13天
  • 原文地址:https://www.cnblogs.com/kaishirenshi/p/7622214.html
Copyright © 2020-2023  润新知