From d7b36eb6d67c184e8f96f5562523507567672590 Mon Sep 17 00:00:00 2001 From: Bruce-Jay Date: Fri, 20 Oct 2023 10:52:53 +0800 Subject: [PATCH 1/2] fix some bugs in installation --- Assignment5.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Assignment5.md b/Assignment5.md index ee8c98b..7a60112 100644 --- a/Assignment5.md +++ b/Assignment5.md @@ -85,9 +85,12 @@ ClickHouse也内置了许多机器学习算法,例如基于梯度下降的线 ### 二)登录数据仓库。Clickhouse数据仓库的登录有很多方式,比如用clickhouse客户端登录,用JDBC(在Java中使用)或者ODBC(在C/C++中使用)访问,用clickhouse-driver(在Python中使用)访问。本实验我们完成clickhouse客户端和clickhouse-driver两种方式。其余方式同学们以后可以自行尝试。 #### 1)使用Clickhouse客户端登录。创建一个最低配置的Centos云主机,选择按流量计费,20M带宽,云主机按小时付费。登录云主机以后运行以下命令,下载Clickhouse安装包。 + +因为网络原因,我们使用阿里云的镜像安装 + ``` -wget https://packages.clickhouse.com/rpm/lts/clickhouse-client-22.3.6.5.noarch.rpm -wget https://packages.clickhouse.com/rpm/lts/clickhouse-common-static-22.3.6.5.x86_64.rpm +wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-client-22.3.6.5.noarch.rpm +wget https://mirrors.aliyun.com/clickhouse/rpm/lts/clickhouse-common-static-22.3.6.5.x86_64.rpm ``` ##### 安装 ``` @@ -101,6 +104,7 @@ clickhouse-client --host=<下图任一节点IP地址> --port=9000 --user=admin - + > 登录后将看到如下界面 @@ -161,11 +165,13 @@ SELECT * FROM ck_test.regression; sudo yum install python3 sudo yum install python3-pip ``` -安装clickhouse-driver +安装clickhouse-driver,这里我们需要用阿里云镜像安装 ``` -pip3 install clickhouse-driver +pip3 install --user -i https://mirrors.aliyun.com/pypi/simple clickhouse-driver ``` +可能会报未找到 gcc 命令的错误,运行 `sudo yum install -y gcc` 就好~ + ##### 2.1)安装完毕后运行python3,然后import clickhouse_driver,若没有报错,则说明clickhouse_driver安装成功。 From 206b5136847694cd1ee1862033fce1230a9e582d Mon Sep 17 00:00:00 2001 From: Bruce-Jay Date: Fri, 20 Oct 2023 11:06:30 +0800 Subject: [PATCH 2/2] Add declaration at head of python file for chinese comments --- Assignment5.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Assignment5.md b/Assignment5.md index 7a60112..749f1ce 100644 --- a/Assignment5.md +++ b/Assignment5.md @@ -180,7 +180,10 @@ pip3 install --user -i https://mirrors.aliyun.com/pypi/simple clickhouse-driver ##### 2.2)quit()退出python3命令行,让我们运行几个Python代码来实现建表,插入,查询等操作。 > 建立createTable.py文件(若忘记创建文件命令可参考[实验一](https://gitea.shuishan.net.cn/xslu_dase_ecnu_edu_cn/cloud-computing-course/src/branch/master/Assignment1.md)),并复制如下代码。其中username,password,hostIP,port都要替换成你的数据仓库参数。 -``` +```python +#!/usr/bin/env python +# _*_ coding:utf-8 _*_ + import clickhouse_driver # 建立连接 @@ -212,7 +215,10 @@ python3 createTable.py ``` > 向COMPANY表中添加一些记录。建立insertTable.py文件,复制如下代码并运行。 -``` +```python +#!/usr/bin/env python +# _*_ coding:utf-8 _*_ + import clickhouse_driver # 建立连接 @@ -227,7 +233,10 @@ conn.close() ``` > 让我们查询一下刚刚建的表。建立selectTable.py文件,复制如下代码并运行。 -``` +```python +#!/usr/bin/env python +# _*_ coding:utf-8 _*_ + import clickhouse_driver # 建立连接