처음 레디 스 클러스터에서 설치 (리눅스 CenOS7)

처음 레디 스 클러스터에서 설치 (리눅스 CenOS7)

는 ISO CentOS7를 사용하여 가상 머신 설치

설치 JDK

  • 사용은 FileZilla업로드 jdk리눅스 시스템에/home/software
[root@localhost software]# mkdir /usr/java
...
[root@localhost software]# mkdir /home/software
...
[root@localhost software]# tar -zxvf jdk-8u231-linux-x64.tar.gz 
...
[root@localhost software]# mv jdk1.8.0_231 /usr/java/
...
  • 구성 자바 환경 변수
  [root@localhost java]# vim /etc/profile
  ...
    #最下方添加下面三条
  export JAVA_HOME=/usr/java/jdk1.8.0_231
  export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
  export PATH=$PATH:$JAVA_HOME/bin
  ...
  [root@localhost java]# source /etc/profile
  [root@localhost java]# java -version
  java version "1.8.0_231"
  Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
  Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

설치 레디 스

  • https://redis.io/download 안정 버전을 다운로드

  • 사용은 FileZilla업로드 redis리눅스 시스템에/home/software

  • 추출 아카이브

    [root@localhost software]# tar -zxvf redis-5.0.7.tar.gz 

    때문에 컴파일하고 레디 스를 생성, 따라서 설치해야 할 필요성gcc

    [root@localhost software]# yum -y install gcc-c++
    ...
    已安装:
      gcc-c++.x86_64 0:4.8.5-39.el7                                                                                                                                                                                       
    
    作为依赖被安装:
      cpp.x86_64 0:4.8.5-39.el7              gcc.x86_64 0:4.8.5-39.el7  glibc-devel.x86_64 0:2.17-292.el7  glibc-headers.x86_64 0:2.17-292.el7  kernel-headers.x86_64 0:3.10.0-1062.9.1.el7  libmpc.x86_64 0:1.0.1-3.el7 
      libstdc++-devel.x86_64 0:4.8.5-39.el7  mpfr.x86_64 0:3.1.1-4.el7 
    
    完毕!

    redis-5.0.7추출 된 디렉토리, 설치를 수행 :

    [root@localhost redis-5.0.7]# make && make install
  • 구성 레디 스

    [root@localhost utils]# ll
    总用量 52
    -rw-rw-r--. 1 root root  593 11月 20 01:05 build-static-symbols.tcl
    -rw-rw-r--. 1 root root 1303 11月 20 01:05 cluster_fail_time.tcl
    -rw-rw-r--. 1 root root 1098 11月 20 01:05 corrupt_rdb.c
    drwxrwxr-x. 2 root root   60 11月 20 01:05 create-cluster
    -rwxrwxr-x. 1 root root 2149 11月 20 01:05 generate-command-help.rb
    drwxrwxr-x. 3 root root   31 11月 20 01:05 graphs
    drwxrwxr-x. 2 root root   39 11月 20 01:05 hashtable
    drwxrwxr-x. 2 root root   70 11月 20 01:05 hyperloglog
    -rwxrwxr-x. 1 root root 9567 11月 20 01:05 install_server.sh
    drwxrwxr-x. 2 root root   63 11月 20 01:05 lru
    -rw-rw-r--. 1 root root 1277 11月 20 01:05 redis-copy.rb
    -rwxrwxr-x. 1 root root 1352 11月 20 01:05 redis_init_script
    -rwxrwxr-x. 1 root root 1047 11月 20 01:05 redis_init_script.tpl
    -rw-rw-r--. 1 root root 1762 11月 20 01:05 redis-sha1.rb
    drwxrwxr-x. 2 root root  135 11月 20 01:05 releasetools
    -rwxrwxr-x. 1 root root 3787 11月 20 01:05 speed-regression.tcl
    -rwxrwxr-x. 1 root root  693 11月 20 01:05 whatisdoing.sh

    전술 한 바와 같이,에 utils디렉토리하는 redis_init_script파일의 파일을 복사 /etc/init.d/하는 목적은 처음부터 부팅되도록 구성 레디 스, 디렉토리.

    [root@localhost utils]# cp redis_init_script  /etc/init.d/
    [root@localhost utils]# mkdir /usr/local/redis -p
    [root@localhost redis-5.0.7]# cp redis.conf /usr/local/redis/
    

    크리에이트 /usr/local/redis레디 스 프로파일을 저장하기위한 디렉토리.

  • 수정 구성 파일을 레디 스

    ################################# GENERAL #####################################
    
    # 修改daemonize no为yes,目的是启动redis以后台进程运行
    daemonize yes
    # 修改redis工作路径(数据存储位置)
    dir /usr/local/redis/workingdb
    # 代表可以被远程访问,不受ip限制
    #bind 127.0.0.1
    bind 0.0.0.0
    # 修改密码
    requirepass 12345678
  • 수정 redis_init_script파일 권한을 수정, 파일 레디 스의 핵심 구성

    
    REDISPORT=6379
    EXEC=/usr/local/bin/redis-server
    CLIEXEC=/usr/local/bin/redis-cli
    
    PIDFILE=/var/run/redis_${REDISPORT}.pid
    CONF="/usr/local/redis/redis.conf"
    [root@localhost init.d]# chmod 777 redis_init_script 
    #启动redis
    [root@localhost init.d]# ./redis_init_script start
    
  • 처음부터 설정 부팅

    1. 에서 /etc/init.d추가 시작 스크립트 파일 경로 #chkconfig: 22345 10 90#description: Start and Stop redis
    [root@iZ2ze7s2v0b78922wia32rZ init.d]# vim redis_init_script 
    #!/bin/sh
    #
    # Simple Redis init.d script conceived to work on Linux systems
    # as it does use of the /proc filesystem.
    
    ### BEGIN INIT INFO
    # Provides:     redis_6379
    # Default-Start:        2 3 4 5
    # Default-Stop:         0 1 6
    # Short-Description:    Redis data structure server
    # Description:          Redis data structure server. See https://redis.io
    ### END INIT INFO
    
    #chkconfig: 22345 10 90
    #description: Start and Stop redis
    
    REDISPORT=6379
    EXEC=/usr/local/bin/redis-server
    CLIEXEC=/usr/local/bin/redis-cli
    
    PIDFILE=/var/run/redis_${REDISPORT}.pid
    CONF="/usr/local/redis/redis.conf"
    1. 실행 chkconfig redis_init_script on, 시작 구성.

    2. 닫기 레디 스

      [root@localhost redis]# /etc/init.d/redis_init_script stop
      Stopping ...
      (error) NOAUTH Authentication required.
      Waiting for Redis to shutdown ...
      Waiting for Redis to shutdown ...
      [root@localhost redis]# vim /etc/init.d/redis_init_script 
      # 在脚本中也需要添加密码验证,才能关闭redis
      stop)
              if [ ! -f $PIDFILE ]
              then
                      echo "$PIDFILE does not exist, process is not running"
              else
                      PID=$(cat $PIDFILE)
                      echo "Stopping ..."
                      $CLIEXEC -a "12345678" -p $REDISPORT shutdown
                      while [ -x /proc/${PID} ]
                      do
                          echo "Waiting for Redis to shutdown ..."
                          sleep 1
                      done
                      echo "Redis stopped"
              fi
              ;;
          *)
      
    3. 방화벽이 CentOS7에 기본적으로 설정되어 있기 때문에 설치 후 원격 연결이 실패합니다

      # 停止防火墙
      [root@localhost ~]# systemctl stop firewalld.service
      # 禁止防火墙开机启动
      [root@localhost ~]# systemctl disable firewalld.service
      Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
      Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
      

      또는 명령을 실행하면 포트 6379을 엽니 다

      firewall-cmd --zone=public --add-port=6379/tcp --permanent

가상 머신 전체 복제

  • 직접 복제 된 VM웨어 퓨전은 오른쪽에있는 기계를 필요로 선택 创建完整克隆

    • CentOS는 7. 직접 IP를 수정

      vim /etc/sysconfig/network-scripts/ifcfg-ens33 # 修改IP配置
      service network restart 重置网络
    • CentOS는 6 또는 일부 버전, 필요는 MAC 주소와 IP를 변경하려면

      vim /etc/udev/rule.d/70-persistent-ipoib.rules
      vim /etc/sysconfig/network-scripts/ifcfg-ens33 # 修改IP配置
      service network restart 重置网络

맥 구성 환경 변수의 실패에서

구성 자신의 ~ / .bash_profile에 환경 변수지만, 터미널 구성의 각 다시 시작 수행하는 효과 필요성을지지 않습니다 후 :. $ 소스 ~ / .bash_profile에의

'.zshrc'파일이 환경 변수 작업을 정의하지 않는 동안 찾을 수 zsh을로드, ~ / .zshrc 파일입니다.

솔루션

마지막으로 ~ / .zshrc 파일에서 한 줄을 추가 :
소스 ~ / .bash_profile에

추천

출처www.cnblogs.com/zhangpan1244/p/12155141.html