• Centos7离线安装ALISQL5.6.32-8


    由于公司设备对数据需要大量的读取和查询,开始使用的mysql8,但是未优化的mysql插入和查询及其缓慢,因此我与同事分开研究,优化方案。我负责寻找可替代高效的数据库,然后问同学,发现alisql性能不错,打算研究下,安装后发现相同未配置情况下,alisql可以快mysql起码十倍。

    注:由于我们程序内存在长索引,但是由于5.6.32基于的mysql版本过老,无法加长索引,故放弃,但是用来一般毕业设计或者没有场索引需求的产品,我认为这是个绝佳的选择。

    如果程序内有一些必须新版mysql才能实现的功能,建议直接放弃此版本数据库。

    安装步骤

    1.系统准备

    安装centos7时,选择带有桌面服务器,软件选择中必选“开发工具”(如果不选开发软件,gcc之类的都是默认不装的,安装起来需要各种依赖很麻烦)

    2、下载准备需要使用的安装包

    ncurses-5.9.tar.gz

    cmake-2.8.10.2.tar.gz

    bison-2.7.tar.gz

    AliSQL-AliSQL-5.6.32-8.tar.gz

    my.cnf(此文件为数据库配置)

    以上为所需要的安装包,自行去网上下载一下。

    或者使用百度网盘:链接: https://pan.baidu.com/s/1VMMH_ZoiaAGRK_pcZYjlAA 提取码: awpi

    将所有安装包和文件拖入到/opt/alisql/下,这个文件夹需要自己创建。

    my.cnf文件内容:

    1. # For advice on how to change settings please see
    2. # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
    3. # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
    4. # *** default location during install, and will be replaced if you
    5. # *** upgrade to a newer version of MySQL.
    6. [mysqld]
    7. # Remove leading # and set to the amount of RAM for the most important data
    8. # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    9. # innodb_buffer_pool_size = 128M
    10. # Remove leading # to turn on a very important data integrity option: logging
    11. # changes to the binary log between backups.
    12. # log_bin
    13. disable_log_bin
    14. # These are commonly set, remove the # and set as required.
    15. # basedir = .....
    16. # datadir = .....
    17. # port = .....
    18. # server_id = .....
    19. # socket = .....
    20. # Remove leading # to set options mainly useful for reporting servers.
    21. # The server defaults are faster for transactions and fast SELECTs.
    22. # Adjust sizes as needed, experiment to find the optimal values.
    23. join_buffer_size = 10M
    24. sort_buffer_size = 10M
    25. # read_rnd_buffer_size = 2M
    26. sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    27. character-set-client-handshake = FALSE
    28. character-set-server = utf8mb4
    29. collation-server = utf8mb4_unicode_ci
    30. init_connect='SET NAMES utf8mb4'
    31. lower_case_table_names = 1

    执行以下脚本:

    1. #!/bin/bash
    2. echo "uninstall alisql ......"
    3. cd /opt/alisql/
    4. tar -zxf ncurses-5.9.tar.gz
    5. cd /opt/alisql/ncurses-5.9/
    6. ./configure
    7. cd /opt/alisql/ncurses-5.9/
    8. make
    9. make install
    10. echo "install ncurses end "
    11. cd /opt/alisql/
    12. tar zxf cmake-2.8.10.2.tar.gz
    13. cd cmake-2.8.10.2
    14. ./bootstrap
    15. make
    16. make install
    17. echo "install cmake end ...... "
    18. sleep 2
    19. cd /opt/alisql/
    20. tar zxf bison-2.7.tar.gz
    21. cd bison-2.7
    22. ./configure
    23. make -j 8
    24. make install
    25. echo "install bison end ...... "
    26. sleep 2
    27. cd /opt/alisql/
    28. groupadd mysql
    29. useradd -r -g mysql mysql
    30. mkdir -p /data/mysqldb
    31. mkdir -p /opt/install
    32. mkdir -p /opt/install/mysql
    33. tar zxvf AliSQL-AliSQL-5.6.32-8.tar.gz
    34. cd /opt/alisql/AliSQL-AliSQL-5.6.32-8/
    35. cmake -DCMAKE_INSTALL_PREFIX=/opt/install/mysql -DMYSQL_UNIX_ADDR=/opt/install/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
    36. cd /opt/alisql/AliSQL-AliSQL-5.6.32-8/
    37. make
    38. make install
    39. echo "change group ... "
    40. cd /opt/install/mysql
    41. chown -R mysql:mysql .
    42. cd /data/mysqldb
    43. chown -R mysql:mysql .
    44. echo "init alisql ... "
    45. cd /opt/install/mysql/
    46. scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb
    47. echo "cpoy my.cnf mysqld ... "
    48. cp /opt/alisql/my.cnf /etc/my.cnf
    49. cp support-files/mysql.server /etc/init.d/mysqld
    50. echo "change path ... "
    51. sed -i '54i\export PATH=/opt/install/mysql/bin:/opt/install/mysql/lib:$PATH' /etc/profile
    52. echo "restart path ... "
    53. sleep 1
    54. source /etc/profile
    55. echo "start mysqld ... "
    56. service mysqld start
    57. echo "Power on start mysqld ... "
    58. chkconfig --level 35 mysqld on
    59. echo "stop firewalld ... "
    60. systemctl stop firewalld
    61. echo "install alisql end ... "
    62. sleep 1

    完成后通过netstat指令查看3306端口是否开启,开启即为成功,若失败自行排查问题。

    进行数据库配置和开启远程连接进行如下操作:

    1. mysql -u root -p
    2. use mysql;
    3. select host,user, password from user;
    4. update user set password=password('mypasswd'), host= '%' where user ='root' and host='127.0.0.1';
    5. update user set password=password('mypasswd') where user ='root' and host='localhost';
    6. flush privileges;

    默认安装本地root登录无密码,第五行的修改语句将本地root登录修改为自己的密码。

    希望以上对初入alisql的人有帮助!
     

  • 相关阅读:
    从“三个比肩”看vivo的高端移动影像野心
    Vue3中如何使用ref获取元素节点全面解析
    《昇思25天学习打卡营第5天|10使用静态图加速》
    【每天一个cmake技巧】简单的cmake demo
    手写简易操作系统(九)--实现打印函数
    【MY杂记】- SpringBoot 配置全局 Json 序列化与反序列化
    软件设计师学习笔记10-死锁资源数计算+进程资源图+段页式存储
    Terraform 语法 provider插件
    MongoDB的安装及命令行操作
    Stream流常见操作
  • 原文地址:https://blog.csdn.net/xuemoKingDeath/article/details/132720609