[关闭]
@zhangyy 2021-06-01T18:49:28.000000Z 字数 2577 阅读 191

tidb的环境安装

tidb


一:tidb 环境安装

1.1 tidb的系统环境准备

  1. cat /etc/hosts
  2. echo "192.168.1.80 node01.flyfish.cn">> /etc/hosts
  3. echo "192.168.1.81 node02.flyfish.cn">> /etc/hosts
  4. echo "192.168.1.82 node03.flyfish.cn">> /etc/hosts
  5. echo "192.168.1.83 node04.flyfish.cn">> /etc/hosts
  6. echo "192.168.1.84 node05.flyfish.cn">> /etc/hosts
  7. echo "192.168.1.85 node06.flyfish.cn">> /etc/hosts
  8. echo "192.168.1.86 node07.flyfish.cn">> /etc/hosts
  9. echo "192.168.1.87 node08.flyfish.cn">> /etc/hosts
  10. echo "192.168.1.88 node09.flyfish.cn">> /etc/hosts
  11. echo "192.168.1.89 node10.flyfish.cn">> /etc/hosts
  12. echo "192.168.1.90 node11.flyfish.cn">> /etc/hosts
  13. echo "192.168.1.91 node12.flyfish.cn">> /etc/hosts
  14. echo "192.168.1.92 node13.flyfish.cn">> /etc/hosts
  15. echo "192.168.1.93 node14.flyfish.cn">> /etc/hosts
  16. echo "export LANG=en_US.UTF8" >> ~/.bash_profile
  17. cat ~/.bash_profile
  18. yum install lvm2 -y
  19. pvcreate /dev/sdb
  20. vgcreate tidbvg /dev/sdb
  21. lvcreate -n tidblv -L 200000M tidbvg
  22. mkfs.ext4 /dev/tidbvg/tidblv
  23. vi /etc/fstab
  24. /dev/sda1 / ext4 defaults 0 0
  25. /dev/sda2 swap swap defaults 0 0
  26. /dev/tidbvg/tidblv /tidb ext4 defaults,nodelalloc,noatime 0 0
  27. mkdir /tidb
  28. mount /tidb
  29. mkdir /tidb/soft
  30. groupadd -g 60001 tidb
  31. useradd -u 61001 -g tidb tidb
  32. chown -R tidb:tidb /tidb
  33. chmod -R 775 /tidb
  34. echo "tidb" | passwd --stdin tidb
  35. systemctl set-default multi-user.target
  36. cat >> /etc/security/limits.conf << EOF
  37. root soft nofile 1048576
  38. root hard nofile 1048576
  39. tidb soft nproc 1048576
  40. tidb hard nproc 1048576
  41. tidb soft nofile 1048576
  42. tidb hard nofile 1048576
  43. tidb soft stack 10240
  44. tidb hard stack 32768
  45. tidb hard memlock unlimited
  46. tidb soft memlock unlimited
  47. EOF
  48. cat >> /etc/sysctl.conf << EOF
  49. fs.aio-max-nr = 1048576
  50. fs.file-max = 6815744
  51. net.ipv4.ip_local_port_range = 1024 65535
  52. net.ipv4.tcp_mem = 786432 2097152 3145728
  53. net.ipv4.tcp_rmem = 4096 4096 16777216
  54. net.ipv4.tcp_wmem = 4096 4096 16777216
  55. vm.swappiness=1
  56. vm.min_free_kbytes=204800000
  57. vm.overcommit_memory=0
  58. EOF
  59. sysctl -p
  60. ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  61. hwclock
  62. echo "SELINUX=disabled" > /etc/selinux/config
  63. echo "#SELINUXTYPE=targeted " >> /etc/selinux/config
  64. cat /etc/selinux/config
  65. setenforce 0
  66. systemctl stop firewalld.service
  67. systemctl disable firewalld.service
  68. umount /mnt
  69. mount /dev/cdrom /mnt
  70. cd /etc/yum.repos.d
  71. mkdir bk
  72. mv *.repo bk/
  73. echo "[EL7-1]" > /etc/yum.repos.d/itpux.repo
  74. echo "name =Linux-7" >> /etc/yum.repos.d/itpux.repo
  75. echo "baseurl=file:///mnt" >> /etc/yum.repos.d/itpux.repo
  76. echo "gpgcheck=0" >> /etc/yum.repos.d/itpux.repo
  77. echo "enabled=1" >> /etc/yum.repos.d/itpux.repo
  78. yum install -y ntp
  79. echo "server 127.127.1.0 iburst" >> /etc/ntp.conf
  80. systemctl restart ntpd
  81. systemctl enable ntpd
  82. ntpq -p
  83. ntpstat
  84. root:
  85. echo "server 192.168.1.80">> /etc/ntp.conf
  86. echo "restrict 192.168.1.80 nomodify notrap noquery" >> /etc/ntp.conf
  87. ntpdate -u 192.168.1.80
  88. hwclock -w
  89. systemctl restart ntpd
  90. systemctl enable ntpd
  91. ntpq -p

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注