SequoiaDB直接管理存储计算引擎

集群管理操作:
链接节点:var db = new Sdb("localhost", 11810);
查看集群拓扑结构:db.list(SDB_LIST_GROUPS);
检查集群节点状态,集群有异常节点时,在 “ErrNodes” 字段中列出:db.snapshot(SDB_SNAP_DATABASE);
创建集合空间和集合:
创建域:db.createDomain("company_domain", [ "group1", "group2", "group3" ], { AutoSplit: true } );
创建集合空间:db.createCS("company", { "Domain": "company_domain" } );
创建集合:db.company.createCL("employee", { "ShardingKey": { "_id": 1 }, "ShardingType": "hash", "ReplSize": -1, "Compressed": true, "CompressionType": "lzw", "AutoSplit": true, "EnsureShardingIndex": false } );
插入数据:db.company.employee.insert( { empno: 1, ename: "Jacky", age: 28, sex: "male" } );
查询记录:db.company.employee.find( { ename: "Abe" } );
修改记录:db.company.employee.update( { $set: { age: 29 } }, { empno: 1 } );
删除记录:db.company.employee.remove( { ename: "Alice" } );

聚集操作:
统计不同性别的平均年龄:db.company.employee.aggregate( { "$group": { "_id": "$sex", "avg_age": { "$avg": "$age" }, "sex": "$sex" } } );
SequoiaDB直接管理存储计算引擎_第1张图片SequoiaDB的内置SQL语句:
单表查询:db.exec("select * from company.manager");
SequoiaDB直接管理存储计算引擎_第2张图片
多表关联查询:db.exec("select a.empno,a.ename,a.age,a.sex,b.department from company.employee as a inner join company.manager as b on a.empno=b.empno ");

你可能感兴趣的:(实习)