• linux 安装redis zookeeper


    安装redis:

    http://www.redis.cn/download.html

    安装的前提条件:

    需要安装gcc:yum install gcc-c++

    wget http://download.redis.io/releases/redis-3.2.8.tar.gz
    tar -zxvf redis-3.2.8.tar.gz
    cd redis-3.2.8
    #进行编译 make
    make
    #创建redis目录 /usr/local/redis
    mkdir redis

    #进入解压目录
    cd /usr/local/redis-3.2.9
    #安装目录 make install PREFIX
    =/usr/local/redis 如提示make无效需要安装gcc 安装完成

     复制配置文件redis.conf 到安装目录

    修改配置文件 

    daemonize yes 后台启动

    requirepass redis 设置密码为redis

    启动

    [root@iZ28mgdqcyxZ bin]# ./redis-server redis.conf

    安装zookeeper

    安装之前要安装jdk 略

     wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz
    #解压
     tar -zxvf zookeeper-3.3.6.tar.gz   
    cd zookeeper-3.3.6/conf  
    拷贝zoo_samle.cfg为zoo.cfg
    cp  zoo_samle.cfg zoo.cfg
    vi zoo.cfg
    # The number of milliseconds of each tick
    tickTime=2000
    # The number of ticks that the initial 
    # synchronization phase can take
    initLimit=10
    # The number of ticks that can pass between 
    # sending a request and getting an acknowledgement
    syncLimit=5
    # the directory where the snapshot is stored.
    dataDir=/mnt/disk/word/children/zookeeper-3.3.6/data
    dataLogDir=/mnt/disk/word/children/zookeeper-3.3.6/logs
    # the port at which the clients will connect
    clientPort=2181
    dataDir=/mnt/disk/word/children/zookeeper-3.3.6/data
    dataLogDir=/mnt/disk/word/children/zookeeper-3.3.6/logs

      注意:这里的data和logs是没有的,要自己创建 mkdir data ,mkdir logs

    设置环境变量

    vi /etc/profile

    #zookeeper
    export ZOOKEEPER_HOME=/mnt/disk/word/children/zookeeper-3.3.6
    export PATH=$PATH:$ZOOKEEPER_HOME/bin

    使环境变量生效 

    source /etc/profile

    启动,任何地方都可以启动

    [root@iZ28mgdqcyxZ conf]# zkServer.sh start

    设置redis & zookeeper 开机启动

    vi /etc/rc.d/rc.local
    
    #加载java环境变量 否则不能启动
    export JAVA_HOME=/var/lib/jvm/jdk1.7.0_80
    #启动zk
    /mnt/disk/word/children/zookeeper-3.3.6/bin/zkServer.sh start
    
    #启动redis
    /mnt/disk/word/children/redis/bin/redis-server /mnt/disk/word/children/redis/bin/redis.conf

    #在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限
    chmod +x /etc/rc.d/rc.local

    centos 7防火墙:

    0、开启防火墙:sudo systemctl start firewalld,service

    1、关闭防火墙:sudo systemctl stop firewalld.service

    2、关闭开机启动:sudo systemctl disable firewalld.service

    3、开启开机启动:sudo systemctl enable firewalld.service

    centos 6防火墙:

    1、关闭防火墙:service iptables stop

    2、开启防火墙:service iptables start

    3、防火墙状态:service iptables status

    完成

  • 相关阅读:
    Qtranslate是Win10系统的一款非常小众的翻译神器,真的是办公人员利器
    大文件查找软件(WizTree) v3.37 ---非常快
    DirPrintOK --- 将文件以树的形式列出、可导出到excel、html文件,用于整理电脑的文件,非常好用
    Linux五大类常用命令
    Android pm list 命令查看手机安装的apk信息
    Android adb命令列出当前设备所有apk安装的路径和包名
    Win10 Python2.7.6 如何使用pip命令?如何离线安装第三方模块?PyCharm设置Python2.7.6,、wxPython安装
    证件照在线免费移除背景或更换背景
    Ubuntu wps办公软件快捷键
    根据书籍的ISBN号查询书籍信息
  • 原文地址:https://www.cnblogs.com/iathanasy/p/8119563.html
Copyright © 2020-2023  润新知