0

0

MemSQL学习笔记-类似MySQL的数据库

黄舟

黄舟

发布时间:2017-02-17 11:47:40

|

3185人浏览过

|

来源于php中文网

原创

http://www.php.cn/


-- 多主-从

http://www.php.cn/
http://www.php.cn/


前facebook员工和前微软sql server工程师联合搞的一个分布式关系数据库
全部内存运行,将sql转化成速度更快的c++, 原理类似hiphop


mysql api, 完全兼容mysql,没有学习使用成本
速度是mysql的30倍,每秒可处理150万的事务


官方网站:http://www.php.cn/
参考文档:http://www.php.cn/


参考官方文档:http://www.php.cn/
http://www.php.cn/
-- ==============================================================


1  Install

wget http://www.php.cn/
tar xvfz memsqlbin_amd64.tar.gzcd memsqlbin./check_systemWarning: The version of CentOS that you're using (5.5) is too low.MemSQL supports versions 6.0 and up.
/home/manchun/memsqlbin/objdir/usr/local/bin/memsql-g++: /lib64/libc.so.6: version GLIBC_2.11' not
 found (required by /home/manchun/memsqlbin/objdir/usr/local/bin/memsql-g++)

【解决办法】安装glibc

[root@banggo ~]# 
wget http://www.php.cn/
tar zxvf glibc-2.11.tar.gz
cd glibc-2.11
mkdir glibc-2.11-build
退出去在别的目录执行如下编译
/usr/src/glibc-2.11/configure --prefix=/usr/src/glibc-2.11/glibc-2.11-build/
error:
checking for .cfi_personality and .cfi_lsda pseudo-ops... no 
configure: error: assembler too old, .cfi_personality support missing


【解决】
参考网址 
http://www.php.cn/ 
http://www.php.cn/


I couldn't overcome that problem, and I'm wondering how I can, but I 
said, "hey cuda only requires glibc-2.7, so lets compile that". I went 
ahead, and installed it into /share/apps/glibc-2.7. So here comes the 
main question: how can I link CUDA C to the glibc-2.7 installed in 
/share/apps ? Years ago, Tim Carlson has said "It is really not 
practical to try and upgrade glibc to 2.5. You might want to try 
installing a glibc 2.5 from source in /share/apps/glibc-2.5 and then 
use LD_PRELOAD to load that library in for you CMAQ binary.", but I 
don't know how to use LD_PRELOAD, and I would appreciate any 
guideline.

[换成2.8]

[root@banggo ~]# 
wget http://www.php.cn/
tar zxvf glibc-2.8.tar.gz
cd glibc-2.8
mkdir glibc-2.8-build

退出去在别的目录执行如下编译

/usr/src/glibc-2.8/configure --prefix=/usr/src/glibc-2.8/glibc-2.8-build/
make
make install


继续执行刚才的check_system

[root@banggo memsqlbin]# ./check_system
Warning: The version of CentOS that you're using (5.5) is too low.
MemSQL supports versions 6.0 and up.
/home/manchun/memsqlbin/objdir/usr/local/bin/memsql-g++: /lib64/libc.so.6: version 'GLIBC_2.11' not
 found (required by /home/manchun/memsqlbin/objdir/usr/local/bin/memsql-g++)

【】我不得不承认,我out了,仔细一看,原来需要centos 6.0的。



2 重新安装

wget http://www.php.cn/
tar xvfz memsqlbin_amd64.tar.gz
cd memsqlbin
 ./check_system

报错如下:

SERCMS游戏币交易系统
SERCMS游戏币交易系统

这套系统是之前为一个朋友开发的一套游戏币交易系统,开发语言asp+javascript 数据库是Access。现在提供免费下载给新人学习,请不要用于商业用处。大分类为:商品管理现金转虚拟币管理 虚拟币转现金管理 历史转换记录 ID搜索虚拟币管理用户管理前台用户管理 被停权的会员 后台管理员添加 后台用户员管理 数据表备份分类管理游戏名称管理 服务器名管理数据统计查询交易类型数据信息管理修改重要公告

下载
Warning: The recommended configuration for MemSQL is at least 8 GB of RAM




【】解决方案:

 let "mem_mb=$(free -m | sed  -n -e '/^Mem:/s/^[^0-9]*\([0-9]*\) .*/\1/p')";
if [ $mem_mb -lt 1000 ]; then
    echo "Warning: The recommended configuration for MemSQL is at least 1 GB of RAM" 1>&2
    invalid='1'
fi
[root@memdb memsqlbin]#  ./check_system 
System check successful

3 登陆测试

[root@memdb memsqlbin]#  ./memsqld --port 3308
299691 2012-06-27 13:26:26 WARNING: SSE4.2 is not supported. Resorting to software CRC32C.
497378 2012-06-27 13:26:27 INFO: Log level changed to 0
120627 13:26:27 [ERROR] Fatal error: Please run MemSQL as a non-root user or specify -u root on the command line.
120627 13:26:27 [ERROR] Aborting
120627 13:26:27 [Note] ./memsqld: Shutdown complete
[root@memdb memsqlbin]#  ./memsqld -u root  --port 3308
292356 2012-06-27 13:26:54 WARNING: SSE4.2 is not supported. Resorting to software CRC32C.
480363 2012-06-27 13:26:55 INFO: Log level changed to 0
120627 13:26:55 [Note] ./memsqld: ready for connections.
Version: '1b'  socket: '/tmp/memsql.sock'  port: 3308




 4 客户端使用

[root@memdb ~]# mysql -uroot -p -h 127.0.0.1 -P3308 --prompt="MemSQL> "
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 253
Server version: 5.5.8 MemSQL source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MemSQL> 
MemSQL> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| memsql             |
+--------------------+
2 rows in set (0.00 sec)
MemSQL> use memsql;
Database changed
MemSQL> show tables;
Empty set (0.00 sec)
MemSQL> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MemSQL> show tables;
+---------------------------------------+
| Tables_in_information_schema          |
+---------------------------------------+
| CHARACTER_SETS                        |
| COLLATIONS                            |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS                               |
| COLUMN_PRIVILEGES                     |
| ENGINES                               |
| EVENTS                                |
| FILES                                 |
| GLOBAL_STATUS                         |
| GLOBAL_VARIABLES                      |
| KEY_COLUMN_USAGE                      |
| PARAMETERS                            |
| PARTITIONS                            |
| PLUGINS                               |
| PROCESSLIST                           |
| PROFILING                             |
| REFERENTIAL_CONSTRAINTS               |
| ROUTINES                              |
| SCHEMATA                              |
| SCHEMA_PRIVILEGES                     |
| STATISTICS                            |
| TABLES                                |
| TABLESPACES                           |
| TABLE_CONSTRAINTS                     |
| TABLE_PRIVILEGES                      |
| TRIGGERS                              |
| USER_PRIVILEGES                       |
| VIEWS                                 |
+---------------------------------------+
28 rows in set (0.00 sec)
MemSQL>

库名字很mysql一模一样啊,好惊奇啊,居然information_schema都有,而且里面的表名字也是一模一样的。

5 配置文件
看看memsql有没有跟mysql类似的配置文件呢,如下,果然找到了

[root@memdb memsqlbin]# ll /root/memsqlbin/memsql.cnf 
-rw-r--r--. 1 1001 1001 1026  6月 18 20:07 /root/memsqlbin/memsql.cnf



6 用户管理测试
-- 创建新账号

MemSQL> grant all on *.* to tim@'%' identified by "tim"  with grant option;
Query OK, 1 row affected (0.01 sec)
MemSQL> exit
Bye

-- 重新登录,输入-p密码,进不去,不输入密码一回车,反倒进去了,怪哉!

[root@memdb memsqlbin]# mysql -utim -ptim -h 127.0.0.1 -P3308 --prompt="MemSQL> "    
ERROR 1045 (28000): Access denied for user 'tim'@'localhost' (using password: YES)
[root@memdb memsqlbin]# mysql -utim -p -h 127.0.0.1 -P3308 --prompt="MemSQL> "   
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 253
Server version: 5.5.8 MemSQL source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MemSQL> 
CREATE TABLE test (
 id int(11) NOT NULL AUTO_INCREMENT,
 excel_id varchar(100) NOT NULL,
 rpt_id int(10) unsigned NOT NULL,
 acc_std tinyint(3) unsigned NOT NULL,
 prd_year int(10) unsigned NOT NULL,
 prd_qtr tinyint(3) unsigned NOT NULL,
 accumulate char(3) NOT NULL,
 biz_cd tinyint(3) unsigned NOT NULL,
 acc_cd tinyint(3) unsigned NOT NULL,
 row_num int(10) unsigned NOT NULL,
 col_num int(10) unsigned NOT NULL,
 data_id int(10) unsigned NOT NULL,
 data_trace mediumtext NOT NULL COMMENT 'trace信息',
 trace_edit tinyint(1) NOT NULL,
 upd_stmp timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
 PRIMARY KEY (id)
) ;

 以上就是MemSQL学习笔记-类似MySQL的数据库的内容,更多相关内容请关注PHP中文网(www.php.cn)! 

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
c语言中/相关合集
c语言中/相关合集

本专题整合了c语言中/的用法、含义解释。阅读专题下面的文章了解更多详细内容。

0

2026.02.03

漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题
漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题

本专题围绕漫蛙漫画(Manwa / Manwa2)官网网页版入口进行整理,涵盖漫蛙漫画官方主页访问方式、网页版在线阅读入口、台版正版漫画浏览说明及基础使用指引,帮助用户快速进入漫蛙漫画官网,稳定在线阅读正版漫画内容,避免误入非官方页面。

0

2026.02.03

Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口
Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口

本专题汇总了俄罗斯知名搜索引擎 Yandex 的官网入口、免登录访问地址、中文登录方法与网页版使用指南,帮助用户稳定访问 Yandex 官网,并提供一站式入口汇总。无论是登录入口还是在线搜索,用户都能快速获取最新稳定的访问链接与使用指南。

2

2026.02.03

Java 设计模式与重构实践
Java 设计模式与重构实践

本专题专注讲解 Java 中常用的设计模式,包括单例模式、工厂模式、观察者模式、策略模式等,并结合代码重构实践,帮助学习者掌握 如何运用设计模式优化代码结构,提高代码的可读性、可维护性和扩展性。通过具体示例,展示设计模式如何解决实际开发中的复杂问题。

1

2026.02.03

C# 并发与异步编程
C# 并发与异步编程

本专题系统讲解 C# 异步编程与并发控制,重点介绍 async 和 await 关键字、Task 类、线程池管理、并发数据结构、死锁与线程安全问题。通过多个实战项目,帮助学习者掌握 如何在 C# 中编写高效的异步代码,提升应用的并发性能与响应速度。

0

2026.02.03

Python 强化学习与深度Q网络(DQN)
Python 强化学习与深度Q网络(DQN)

本专题深入讲解 Python 在强化学习(Reinforcement Learning)中的应用,重点介绍 深度Q网络(DQN) 及其实现方法,涵盖 Q-learning 算法、深度学习与神经网络的结合、环境模拟与奖励机制设计、探索与利用的平衡等。通过构建一个简单的游戏AI,帮助学习者掌握 如何使用 Python 训练智能体在动态环境中作出决策。

1

2026.02.03

python end=
python end=

本专题整合了python中end=的相关内容,阅读专题下面的文章了解更多详细内容。

0

2026.02.03

python运算符优先级
python运算符优先级

本专题整合了python运算符优先级排序、用法相关内容,阅读专题下面的文章了解更多详细内容。

1

2026.02.03

python print用法与作用
python print用法与作用

本专题整合了python print的用法、作用、函数功能相关内容,阅读专题下面的文章了解更多详细教程。

1

2026.02.03

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
MySQL 教程
MySQL 教程

共48课时 | 2.1万人学习

MySQL 初学入门(mosh老师)
MySQL 初学入门(mosh老师)

共3课时 | 0.3万人学习

简单聊聊mysql8与网络通信
简单聊聊mysql8与网络通信

共1课时 | 821人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号