redash 在CentOS8环境部署(非docker)
redesh Centos參考地址:
python2.7 環(huán)境:https://ld246.com/article/1519440121831
我是按python3環(huán)境 :https://blog.csdn.net/htmljsp/article/details/126194715
一、環(huán)境準備
- 單機安裝 redis
官網(wǎng)安裝地址:
https://redis.io/docs/getting-started/installation/install-redis-from-source/
選擇按源碼編譯安裝
wget https://download.redis.io/redis-stable.tar.gz安裝C++編譯環(huán)境、make
yum -y install gcc automake autoconf libtool make ##驗證成功 whereis make錯誤:configure: error: no acceptable C compiler found in $PATH解決:需要按照C++編譯環(huán)境
To compile Redis, first the tarball, change to the root directory, and then run make:
tar -xzvf redis-stable.tar.gz cd redis-stable make結果輸出:......
CC redis-cli.o
CC redisassert.o
CC cli_common.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
INSTALL redis-check-rdb
INSTALL redis-check-aof
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory '/var/tools/redis-stable/src'
-----------------------------------------------------------
make之后,會在src目錄下增加兩個目錄:
-rwxr-xr-x 1 root root 7237624 Jan 11 04:09 redis-cli
... ...
-rwxr-xr-x 1 root root 14403144 Jan 11 04:09 redis-server
redis-server: the Redis Server itself
redis-cli is the command line interface utility to talk with Redis.
To install these binaries in /usr/local/bin, run:
make install 結果輸出: cd src && make install make[1]: Entering directory '/var/tools/redis-stable/src' /usr/bin/which: no python3 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/jdk/bin:/root/bin) /usr/bin/which: no python in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/jdk/bin:/root/bin)CC Makefile.dep /usr/bin/which: no python3 in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/jdk/bin:/root/bin) /usr/bin/which: no python in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/var/jdk/bin:/root/bin)Hint: It's a good idea to run 'make test' ;)INSTALL redis-serverINSTALL redis-benchmarkINSTALL redis-cli make[1]: Leaving directory '/var/tools/redis-stable/src'啟動redis:
redis-server 結果輸出: 50281:C 11 Jan 2023 04:19:56.559 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 50281:C 11 Jan 2023 04:19:56.559 # Redis version=7.0.7, bits=64, commit=00000000, modified=0, pid=50281, just started 50281:C 11 Jan 2023 04:19:56.559 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 50281:M 11 Jan 2023 04:19:56.560 * Increased maximum number of open files to 10032 (it was originally set to 1024). 50281:M 11 Jan 2023 04:19:56.560 * monotonic clock: POSIX clock_gettime_.__.-``__ ''-.__.-`` `. `_. ''-._ Redis 7.0.7 (00000000/0) 64 bit.-`` .-```. ```\/ _.,_ ''-._( ' , .-` | `, ) Running in standalone mode|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379| `-._ `._ / _.-' | PID: 50281`-._ `-._ `-./ _.-' _.-'|`-._`-._ `-.__.-' _.-'_.-'|| `-._`-._ _.-'_.-' | https://redis.io`-._ `-._`-.__.-'_.-' _.-'|`-._`-._ `-.__.-' _.-'_.-'|| `-._`-._ _.-'_.-' |`-._ `-._`-.__.-'_.-' _.-'`-._ `-.__.-' _.-'`-._ _.-'`-.__.-'50281:M 11 Jan 2023 04:19:56.561 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 50281:M 11 Jan 2023 04:19:56.561 # Server initialized 50281:M 11 Jan 2023 04:19:56.561 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 50281:M 11 Jan 2023 04:19:56.562 * Ready to accept connectionsTo stop Redis, enter Ctrl-C.
測試安裝成功:
redis-cli -h 127.0.0.1 -p 6379 127.0.0.1:6379> set a1 111 OK 127.0.0.1:6379> get a1 "111" 127.0.0.1:6379>- 安裝 PostgreSQL 數(shù)據(jù)庫
安裝
# Install the repository RPM: sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm# Disable the built-in PostgreSQL module: sudo dnf -qy module disable postgresql# Install PostgreSQL: sudo dnf install -y postgresql15-server初始化
# Optionally initialize the database and enable automatic start: sudo /usr/pgsql-15/bin/postgresql-15-setup initdb sudo systemctl enable postgresql-15 sudo systemctl start postgresql-15配置
postgresql.conf
安裝后路徑:/var/lib/pgsql/15,修改配置文件
vi /var/lib/pgsql/15/data/postgresql.conf #增加一行: listen_addresses = '*'pg_hba.conf
配置文件修改: /var/lib/pgsql/15/data pg_hba.conf 添加 host all all 0.0.0.0/0 md5 host replication all 0.0.0.0/0 md5設置用戶密碼
PostgreSQL會創(chuàng)建一個默認的linux用戶postgres和一個數(shù)據(jù)庫用戶postgres,修改pg數(shù)據(jù)庫帳號密碼
注:后來思考,如有pg上已經有了postgres庫及用戶,會與存在的系統(tǒng)沖突;嘗試新建用戶redash及數(shù)據(jù)庫redash,增強兼容性。
#通過su命令切換linux用戶為postgres會自動進入命令行 su postgres #啟動SQL Shell psql #修改密碼 ALTER USER postgres WITH PASSWORD 'NewPassword';如:
[root@localhost ~]# su postgres
bash-4.4$ psql
could not change directory to "/root": Permission denied
psql (15.1)
Type "help" for help.
postgres=# ALTER USER postgres WITH PASSWORD 'NewPassword';
psql基礎知識點:
另一種登錄方式:在root帳號:
psql -h192.168.85.131 -U postgres
#類似show databases;
\l 或 select datname from pg_database;
#切換數(shù)據(jù)庫
\c 數(shù)據(jù)庫名
#類似show tables
\dt 或SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
#describe table_name;
\d tablename或 SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';
重置linux用戶postgres密碼
#在root帳號下,刪除postgres密碼 passwd -d postgres #設置新密碼 sudo -u postgres passwd sys- python環(huán)境
安裝python隔離
yum install python3-pip pip3 install virtualenv #測試 virtualenv --version驗證
進入隔離環(huán)境
source current/bin/activate 如: [root@localhost tools]# source current/bin/activate (current) [root@localhost tools]#退出隔離環(huán)境
deactivate 如: (current) [root@localhost tools]# deactivate- 安裝 nodejs 相關
https://github.com/nodesource/distributions
https://github.com/nodejs/Release
下載node 18
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
yum -y install nodejs
#安裝node,這里應該安裝16.X版本一下的,redash 需要14版本,到17版本以上,node增加了秘鑰限制,造成后續(xù)build失敗,我裝的18版本 curl -fsSL https://rpm.nodesource.com/setup_18.x | bash - yum -y install nodejs##結果輸出:========================================================= ## Installing the NodeSource Node.js 18.x repo...## Inspecting system...+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release || rpm -q --whatprovides fedora-release + uname -m## Confirming "el8-x86_64" is supported...+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_18.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'## As yum will try to install Node.js from the AppStream repository instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled. ## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository.+ yum module disable -y nodejs Node.js Packages for Enterprise Linux 8 - x86_64 72 kB/s | 401 kB 00:05 Last metadata expiration check: 0:00:02 ago on Thu 12 Jan 2023 03:04:34 AM EST. Dependencies resolved. Nothing to do. Complete!## Downloading release setup RPM...+ mktemp + curl -sL -o '/tmp/tmp.FQAhDiThfX' 'https://rpm.nodesource.com/pub_18.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm'## Installing release setup RPM...+ rpm -i --nosignature --force '/tmp/tmp.FQAhDiThfX'## Cleaning up...+ rm -f '/tmp/tmp.FQAhDiThfX'## Checking for existing installations...+ rpm -qa 'node|npm' | grep -v nodesource## Run `sudo yum install -y nodejs` to install Node.js 18.x and npm. ## You may run dnf if yum is not available:sudo dnf install -y nodejs ## You may also need development tools to build native addons:sudo yum install gcc-c++ make ## To install the Yarn package manager, run:curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.reposudo yum install yarn ===================================================#驗證
node -v
npm -v
#修改npm下載資源地址
[root@localhost var]# npm get registry
https://registry.npmjs.org/
[root@localhost var]# npm config set registry http://registry.npm.taobao.org/
[root@localhost var]# npm get registry
http://registry.npm.taobao.org/
- 安裝redash
下載源碼
yum install git git clone https://github.com/getredash/redash.git創(chuàng)建項目虛擬環(huán)境
#先創(chuàng)建存儲虛擬環(huán)境的獨立目錄 cd /var mkdir -p py_virtual python3 -m venv env_redash 注意:在py_virtual下生成一個目錄 env_redash,下次啟動虛擬環(huán)境時,進入這個目錄,啟動 #激活環(huán)境 source env_redash/bin/activate#可選,配置進入虛擬環(huán)境的快捷命令,在文件末尾增加一行,以后鍵入to_env_redash可以在任意目錄進入虛擬環(huán)境 vi /etc/profile alias to_env_redash='cd /var/py_virtula && source env_redash/bin/activate' source /etc/profile安裝依賴包
-----------------------
注意:這塊會因為網(wǎng)絡延遲高反復報timeout錯誤,我是將反復下載不下來的包,在requirement txt文件進行#號注釋,回頭下載
requirements.txt 我注釋了passlib 、psycopg2-2.8.3,這兩個包手工解決,下面有操作。
requirements_all_ds 我只保留了3個package:pymssql, pyhive, mysqlclient:Successfully installed mysqlclient-1.3.14 pyhive-0.6.1 pymssql-2.1.4
如果全部安裝會卡住:
Getting requirements to build wheel ...\ 之后無反應,暫時沒有定位原因
#配置pip國內鏡像,進入用戶目錄 cd ~ mkdir .pip cd .pip vi pip.conf [global] trusted-host = mirrors.aliyun.com index-url = http://mirrors.aliyun.com/pypi/simple#在虛擬環(huán)境安裝pip pip install --upgrade pip pip install --upgrade setuptools ##看情況安裝 #安裝redash需要的py環(huán)境 python -m pip install -r /var/tools/redash/requirements.txt python -m pip install -r /var/tools/redash/requirements_dev.txt python -m pip install -r /var/tools/redash/requirements_all_ds.txt pip install wheel pip3 install importlib_resources==1.5 pip3 install redis yum -y install cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib pip install saslpip install thrift pip install thrift-sasl編譯
npm install --legacy-peer-deps
##將路徑切換到redash根目錄,否則執(zhí)行編譯安裝,會報下面問題;--legacy-peer-deps保證本地package版本與遠程版本不一致時,保留本地版本 (env_redash) [root@localhost redash]# npm install --legacy-peer-deps npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /usr/include/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/usr/include/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoentnpm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-01-13T02_02_28_162Z-debug-0.log 解決:運行目錄需要在redash根目錄上,與package.json在一個位置查看yarn是否被安裝且鏡像要設置國內
yarn -v
如果沒有安裝,參考下面問題解決方式
最終成功的結果輸出:(env_redash) [root@localhost redash]# npm install --legacy-peer-deps npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'redash-client@11.0.0-dev', npm WARN EBADENGINE required: { node: '^14.16.1', yarn: '^1.22.10' }, npm WARN EBADENGINE current: { node: 'v18.12.1', npm: '8.19.2' } npm WARN EBADENGINE }> redash-client@11.0.0-dev preinstall > cd viz-lib && yarn link --link-folder ../.yarnyarn link v1.22.19 warning There's already a package called "@redash/viz" registered. This command has had no effect. If this command was run in another folder with the same name, the other folder is still linked. Please run yarn unlink in the other folder if you want to register this folder. Done in 0.05s.> redash-client@11.0.0-dev postinstall > (cd viz-lib && yarn --frozen-lockfile && yarn build:babel) && yarn link --link-folder ./.yarn @redash/vizyarn install v1.22.19 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... warning " > leaflet.markercluster@1.4.1" has incorrect peer dependency "leaflet@~1.3.1". warning " > react-pivottable@0.9.0" has unmet peer dependency "react@>=15.0.0". warning " > react-pivottable@0.9.0" has unmet peer dependency "react-dom@>=15.0.0". warning "react-pivottable > react-sortablejs@1.5.1" has unmet peer dependency "react@>=15.0.0". warning "react-pivottable > react-sortablejs@1.5.1" has unmet peer dependency "react-dom@>=15.0.0". warning " > react-sortable-hoc@1.11.0" has unmet peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0". warning " > react-sortable-hoc@1.11.0" has unmet peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0". warning " > use-debounce@3.4.1" has unmet peer dependency "react@>=16.8.0". warning " > use-media@1.4.0" has unmet peer dependency "react@^16.8.1". warning " > enzyme-adapter-react-16@1.15.2" has unmet peer dependency "react@^16.0.0-0". warning " > enzyme-adapter-react-16@1.15.2" has unmet peer dependency "react-dom@^16.0.0-0". warning "enzyme-adapter-react-16 > enzyme-adapter-utils@1.13.0" has unmet peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0". warning "enzyme-adapter-react-16 > react-test-renderer@16.13.1" has unmet peer dependency "react@^16.13.1". warning "enzyme-adapter-react-16 > enzyme-adapter-utils > airbnb-prop-types@2.15.0" has unmet peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha". [4/4] Building fresh packages... Done in 496.78s. yarn run v1.22.19 $ yarn type-gen && yarn build:babel:base $ tsc --emitDeclarationOnly $ babel src --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored --extensions .ts,.tsx,.js,.jsx Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Successfully compiled 169 files with Babel. Done in 22.88s. yarn link v1.22.19 success Using linked package for "@redash/viz". Done in 0.05s.npm run build
npm run build ##這塊遇到一些版本沖突的問題,redash需要的版本14,安裝的版本是18,造成失敗,解決見下面問題說明##最終成功的輸出: (env_redash) [root@localhost redash]# npm run build> redash-client@11.0.0-dev build > yarn clean && yarn build:viz && NODE_ENV=production webpackyarn run v1.22.19 $ rm -rf ./client/dist/ Done in 0.07s. yarn run v1.22.19 $ (cd viz-lib && yarn build:babel) $ yarn type-gen && yarn build:babel:base $ tsc --emitDeclarationOnly $ babel src --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored --extensions .ts,.tsx,.js,.jsx Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db Successfully compiled 169 files with Babel. Done in 20.17s. Hash: 0e418f37309c0dbd4af0 Version: webpack 4.44.2 Time: 137707ms Built at: 01/13/2023 12:25:06 AMAsset Size Chunks Chunk Namesapp.ff07d294a870fae6461f.css 696 KiB 0 [emitted] [immutable] [big] appapp.ff07d294a870fae6461f.css.map 860 KiB 0 [emitted] [dev] appapp.ff07d294a870fae6461f.js 607 KiB 0 [emitted] [immutable] [big] appapp.ff07d294a870fae6461f.js.map 1.28 MiB 0 [emitted] [dev] appasset-manifest.json 10.4 KiB [emitted]data/0962607.countries.geo.json 383 KiB [emitted] [big]data/dac34f3.japan.prefectures.geo.json 567 KiB [emitted] [big]data/eed73d1.usa-albers.geo.json 528 KiB [emitted] [big]fonts/Material-Design-Iconic-Font.a4d3112.woff2 37.5 KiB [emitted]fonts/Material-Design-Iconic-Font.b351bd6.ttf 96.9 KiB [emitted]fonts/Material-Design-Iconic-Font.d2a55d3.woff 49.1 KiB [emitted]fonts/fontawesome-webfont.674f50d.eot 162 KiB [emitted]fonts/fontawesome-webfont.af7ae50.woff2 75.4 KiB [emitted]fonts/fontawesome-webfont.b06871f.ttf 162 KiB [emitted]fonts/fontawesome-webfont.fee66e7.woff 95.7 KiB [emitted]fonts/glyphicons-halflings-regular.448c34a.woff2 17.6 KiB [emitted]fonts/glyphicons-halflings-regular.e18bbf6.ttf 44.3 KiB [emitted]fonts/glyphicons-halflings-regular.f4769f9.eot 19.7 KiB [emitted]fonts/glyphicons-halflings-regular.fa27723.woff 22.9 KiB [emitted]fonts/roboto/Roboto-Bold-webfont.eot 20.5 KiB [emitted]fonts/roboto/Roboto-Bold-webfont.svg 69.6 KiB [emitted]fonts/roboto/Roboto-Bold-webfont.ttf 44 KiB [emitted]fonts/roboto/Roboto-Bold-webfont.woff 24.2 KiB [emitted]fonts/roboto/Roboto-Light-webfont.eot 20.4 KiB [emitted]fonts/roboto/Roboto-Light-webfont.svg 72.6 KiB [emitted]fonts/roboto/Roboto-Light-webfont.ttf 44.8 KiB [emitted]fonts/roboto/Roboto-Light-webfont.woff 24 KiB [emitted]fonts/roboto/Roboto-Medium-webfont.eot 20.9 KiB [emitted]fonts/roboto/Roboto-Medium-webfont.svg 70.1 KiB [emitted]fonts/roboto/Roboto-Medium-webfont.ttf 44.2 KiB [emitted]fonts/roboto/Roboto-Medium-webfont.woff 24.5 KiB [emitted]fonts/roboto/Roboto-Regular-webfont.eot 20.8 KiB [emitted]fonts/roboto/Roboto-Regular-webfont.svg 71.5 KiB [emitted]fonts/roboto/Roboto-Regular-webfont.ttf 44.3 KiB [emitted]fonts/roboto/Roboto-Regular-webfont.woff 24.4 KiB [emitted]fonts/roboto/Roboto-Thin-webfont.eot 21.2 KiB [emitted]fonts/roboto/Roboto-Thin-webfont.svg 72.3 KiB [emitted]fonts/roboto/Roboto-Thin-webfont.ttf 46.6 KiB [emitted]fonts/roboto/Roboto-Thin-webfont.woff 24.4 KiB [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet-fullscreen/dist/fullscreen.png 299 bytes [emitted] images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet-fullscreen/dist/fullscreen@2x.png 420 bytes [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet/dist/images/layers-2x.png 1.23 KiB [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet/dist/images/layers.png 696 bytes [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet/dist/images/marker-icon-2x.png 2.41 KiB [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet/dist/images/marker-icon.png 1.43 KiB [emitted]images/_/_/_/_/node_modules/@redash/viz/node_modules/leaflet/dist/images/marker-shadow.png 618 bytes [emitted]images/_/_/_/_/node_modules/bootstrap/fonts/glyphicons-halflings-regular.svg 106 KiB [emitted]images/_/_/_/_/node_modules/font-awesome/fonts/fontawesome-webfont.svg 434 KiB [emitted] [big]images/_/_/redash-font/fonts/redash-icons.svg 2.67 KiB [emitted]images/avatar.svg 2.09 KiB [emitted]images/db-logos/Cassandra.png 27.8 KiB [emitted]images/db-logos/arangodb.png 96.9 KiB [emitted]images/db-logos/athena.png 12.3 KiB [emitted]images/db-logos/aws_es.png 8.08 KiB [emitted]images/db-logos/axibasetsd.png 6.23 KiB [emitted]images/db-logos/azure_kusto.png 4.95 KiB [emitted]images/db-logos/bigquery.png 20.2 KiB [emitted]images/db-logos/bigquery_gce.png 20.2 KiB [emitted]images/db-logos/clickhouse.png 2.89 KiB [emitted]images/db-logos/cloudwatch.png 4.08 KiB [emitted]images/db-logos/cloudwatch_insights.png 4.08 KiB [emitted]images/db-logos/cockroach.png 15.5 KiB [emitted]images/db-logos/corporate_memory.png 1.54 KiB [emitted]images/db-logos/couchbase.png 12.7 KiB [emitted]images/db-logos/csv.png 6 KiB [emitted]images/db-logos/databricks.png 2.82 KiB [emitted]images/db-logos/db2.png 13.1 KiB [emitted]images/db-logos/dgraph.png 42.3 KiB [emitted]images/db-logos/drill.png 26.1 KiB [emitted]images/db-logos/druid.png 11.2 KiB [emitted]images/db-logos/dynamodb_sql.png 12.3 KiB [emitted]images/db-logos/elasticsearch.png 16.2 KiB [emitted]images/db-logos/elasticsearch2.png 16.2 KiB [emitted]images/db-logos/elasticsearch2_OpenDistroSQLElasticSearch.png 16.2 KiB [emitted]images/db-logos/elasticsearch2_XPackSQLElasticSearch.png 16.2 KiB [emitted]images/db-logos/exasol.png 5.35 KiB [emitted]images/db-logos/excel.png 3.63 KiB [emitted]images/db-logos/firebolt.png 12.4 KiB [emitted]images/db-logos/google_analytics.png 14.3 KiB [emitted]images/db-logos/google_spreadsheets.png 13.4 KiB [emitted]images/db-logos/graphite.png 21.6 KiB [emitted]images/db-logos/hive.png 24.6 KiB [emitted]images/db-logos/hive_http.png 24.6 KiB [emitted]images/db-logos/impala.png 14.4 KiB [emitted]images/db-logos/influxdb.png 18.5 KiB [emitted]images/db-logos/jirajql.png 11.7 KiB [emitted]images/db-logos/json.png 12.8 KiB [emitted]images/db-logos/kibana.png 8.87 KiB [emitted]images/db-logos/kylin.png 23.8 KiB [emitted]images/db-logos/mapd.png 7.92 KiB [emitted]images/db-logos/memsql.png 12.1 KiB [emitted]images/db-logos/mongodb.png 9.08 KiB [emitted]images/db-logos/mssql.png 23.1 KiB [emitted]images/db-logos/mssql_odbc.png 23.1 KiB [emitted]images/db-logos/mysql.png 12.3 KiB [emitted]images/db-logos/nz.png 1.25 KiB [emitted]images/db-logos/oracle.png 4.35 KiB [emitted]images/db-logos/pg.png 25.2 KiB [emitted]images/db-logos/phoenix.png 20.3 KiB [emitted]images/db-logos/pinot.png 29 KiB [emitted]images/db-logos/presto.png 13.5 KiB [emitted]images/db-logos/prometheus.png 15.2 KiB [emitted]images/db-logos/python.png 19.1 KiB [emitted]images/db-logos/qubole.png 2.37 KiB [emitted]images/db-logos/rds_mysql.png 13.5 KiB [emitted]images/db-logos/redshift.png 6.01 KiB [emitted]images/db-logos/redshift_iam.png 6.01 KiB [emitted]images/db-logos/results.png 12.8 KiB [emitted]images/db-logos/rockset.png 6.61 KiB [emitted]images/db-logos/salesforce.png 18.2 KiB [emitted]images/db-logos/scylla.png 22.7 KiB [emitted]images/db-logos/snowflake.png 18.5 KiB [emitted]images/db-logos/sparql_endpoint.png 31 KiB [emitted]images/db-logos/sqlite.png 13.7 KiB [emitted]images/db-logos/treasuredata.png 14.6 KiB [emitted]images/db-logos/trino.png 23.2 KiB [emitted]images/db-logos/uptycs.png 2.57 KiB [emitted]images/db-logos/url.png 8.36 KiB [emitted]images/db-logos/vertica.png 6.36 KiB [emitted]images/db-logos/yandex_appmetrika.png 1.42 KiB [emitted]images/db-logos/yandex_metrika.png 824 bytes [emitted]images/destinations/chatwork.png 11.3 KiB [emitted]images/destinations/email.png 6.14 KiB [emitted]images/destinations/hangouts_chat.png 9.29 KiB [emitted]images/destinations/hipchat.png 11.5 KiB [emitted]images/destinations/mattermost.png 12 KiB [emitted]images/destinations/microsoft_teams_webhook.png 4.11 KiB [emitted]images/destinations/pagerduty.png 8.21 KiB [emitted]images/destinations/slack.png 6.71 KiB [emitted]images/destinations/webhook.png 11.9 KiB [emitted]images/favicon-16x16.png 1.33 KiB [emitted]images/favicon-32x32.png 1.96 KiB [emitted]images/favicon-96x96.png 3.82 KiB [emitted]images/fixtures/map-tile.png 5.32 KiB [emitted]images/google_logo.svg 688 bytes [emitted]images/illustrations/alert.svg 70.5 KiB [emitted]images/illustrations/dashboard.svg 137 KiB [emitted]images/illustrations/no-query-results.svg 1.56 KiB [emitted]images/illustrations/query.svg 68 KiB [emitted]images/logo.png 32.8 KiB [emitted]images/logo_white.png 33.3 KiB [emitted]images/redash_icon_small.png 5.97 KiB [emitted]index.html 1.47 KiB [emitted]multi_org.html 1.4 KiB [emitted]robots.txt 31 bytes [emitted]server.f5927c7d1e72ad202352.css 182 KiB 1 [emitted] [immutable] serverserver.f5927c7d1e72ad202352.css.map 231 KiB 1 [emitted] [dev] serverserver.f5927c7d1e72ad202352.js 1.02 KiB 1 [emitted] [immutable] serverserver.f5927c7d1e72ad202352.js.map 4.55 KiB 1 [emitted] [dev] serverstyles/login.css 1.01 KiB [emitted]unsupported.html 1.5 KiB [emitted]unsupportedRedirect.js 155 bytes [emitted]vendors~app.417d1435f1002cd83105.css 75.7 KiB 2 [emitted] [immutable] vendors~appvendors~app.417d1435f1002cd83105.css.map 103 KiB 2 [emitted] [dev] vendors~appvendors~app.417d1435f1002cd83105.js 3.82 MiB 2 [emitted] [immutable] [big] vendors~appvendors~app.417d1435f1002cd83105.js.map 16 MiB 2 [emitted] [dev] vendors~app Entrypoint app [big] = vendors~app.417d1435f1002cd83105.css vendors~app.417d1435f1002cd83105.js vendors~app.417d1435f1002cd83105.css.map vendors~app.417d1435f1002cd83105.js.map app.ff07d294a870fae6461f.css app.ff07d294a870fae6461f.js app.ff07d294a870fae6461f.css.map app.ff07d294a870fae6461f.js.map Entrypoint server = server.f5927c7d1e72ad202352.css server.f5927c7d1e72ad202352.js server.f5927c7d1e72ad202352.css.map server.f5927c7d1e72ad202352.js.map配置
前端這邊不得不提一點,redash 項目前后端分離。中間依托了前端 node 的一個叫 dev-server 的服務器用于轉發(fā)前后端請求。所以當我們在訪問 redash 的時候其實請求會先打到 node 服務器那邊然后再由 node 的服務器進行轉發(fā)到后端 flask 服務器。
這里因為我只打算在入口的位置來配置 nginx 服務器,并不打算在 redash 服務器這邊再用 nginx 轉發(fā)一下。所以這里我需要配置 redash 的 node 服務器去監(jiān)聽 0.0.0.0 所有范圍的8080 端口。8080端口是默認的所以我修改了 node 里面的 webpack.config.js 配置指定讓 devServer 監(jiān)聽 0.0.0.0 地址。
服務器端部分其實有很多值得注意的地方。首先 readsh 給我們的默認配置是默認我們剛才將那些組件都安裝在了同一臺機器上面,否則你就必須面臨一個重新配置相關配置參數(shù)的局面。好在 redash 將配置文件的修改放在了還算清晰的地方。
如果你沒有在代碼里面添加 .env 文件,所有后端服務啟動的時候會默認去讀取環(huán)境變量中的配置。如果環(huán)境變量里面沒有配置相關的參數(shù),那么將會直接使用所有參數(shù)的默認值加載。
redash 的配置寫在 -> redash/redash/settings/__init__.py 中,這里囊括了所有的配置。如果使用環(huán)境變量的配置要到這里來這里參考 key 的名稱。
redash目錄:/var/tools/redash
webpack.config.js
#localhost改成127.0.0.1,linux會把localhost解析成ipv6,導致前端請求在后臺代理轉發(fā)時,找不到ip const redashBackend = process.env.REDASH_BACKEND || "http://127.0.0.1:5000";devServer: { ##增加hosthost: '0.0.0.0', ... ...proxy: [{context: ["/login","/logout","/invite","/setup","/status.json","/api","/oauth"],target: redashBackend + "/",changeOrigin: true,##################################false 改成truesecure: false},{context: path => {// CSS/JS for server-rendered pages should be served from backendreturn /^\/static\/[a-z]+\.[0-9a-fA-F]+\.(css|js)$/.test(path);},target: redashBackend + "/",changeOrigin: true,secure: false}package.json
在start 行末尾增加 --disableHostCheck=true,在后續(xù)啟動node運行npm run start時,會運行這段代碼
"scripts": {"start": "npm-run-all --parallel watch:viz webpack-dev-server --disableHostCheck=true",redash/settings/__init__.py
配置redis地址:我是本地redis,不用動
_REDIS_URL = os.environ.get("REDASH_REDIS_URL", os.environ.get("REDIS_URL", "redis://localhost:6379/0") )配置redash數(shù)據(jù)庫地址:指向postgres地址
SQLALCHEMY_DATABASE_URI = os.environ.get("REDASH_DATABASE_URL", os.environ.get("DATABASE_URL", "postgresql://用戶名:密碼@192.168.16.43/數(shù)據(jù)庫") )配置加密key,key值隨機生成
python -c 'import secrets; print(secrets.token_hex())'結果輸出: #用于設置REDASH_COOKIE_SECRET (env_redash) [root@localhost redash]# python -c 'import secrets; print(secrets.token_hex())' 1d651e7057be0307a9ef8527c19ffec18f22de2ab5fdf2a71ff5ceda79abfec0 #用于設置REDASH_SECRET_KEY (env_redash) [root@localhost redash]# python -c 'import secrets; print(secrets.token_hex())' 3fb8928e0314191a9177097d6578e6276159e9b267a4dca108dc550a6f89654fSECRET_KEY = os.environ.get("REDASH_COOKIE_SECRET","1d651e7057be0307a9ef8527c19ffec18f22de2ab5fdf2a71ff5ceda79abfec0")新建.env文件
在redash根目錄下建環(huán)境文件.env,REDASH_COOKIE_SECRET和REDASH_SECRET_KEY與__init__.py一致
NUNBUFFERED="0" REDASH_LOG_LEVEL="INFO" REDASH_REDIS_URL="redis://localhost:6379/0" POSTGRES_PASSWORD="Gao****2" REDASH_COOKIE_SECRET="1d651e7057be0307a9ef8527c19ffec18f22de2ab5fdf2a71ff5ceda79abfec0" REDASH_SECRET_KEY="3fb8928e0314191a9177097d6578e6276159e9b267a4dca108dc550a6f89654f" REDASH_DATABASE_URL="postgresql://postgres:Gao****2@192.168.85.131:5432/postgres" REDASH_BACKEND="http://127.0.0.1:5000"檢查
bin/run ./manage.py check-settings初始化數(shù)據(jù)庫
#修改python報警忽略 vi /var/py_virtual/env_redash/lib64/python3.6/site-packages/psycopg2/__init__.py 增加下面內容: # This is a wheel package: issue a warning on import import warnings warnings.filterwarnings("ignore")#初始化 bin/run ./manage.py database create-tables 輸出結果: (env_redash) [root@localhost redash]# bin/run ./manage.py database create-tables NUNBUFFERED="0" export REDASH_LOG_LEVEL="INFO" export REDASH_REDIS_URL="redis://localhost:6379/0" POSTGRES_PASSWORD="Gao6584802" export REDASH_COOKIE_SECRET="1d651e7057be0307a9ef8527c19ffec18f22de2ab5fdf2a71ff5ceda79abfec0" export REDASH_SECRET_KEY="3fb8928e0314191a9177097d6578e6276159e9b267a4dca108dc550a6f89654f" export REDASH_DATABASE_URL="postgresql://postgres:Gao6584802@192.168.85.131:5432/postgres"[2023-01-15 13:11:05,819][PID:833507][INFO][alembic.runtime.migration] Context impl PostgresqlImpl. [2023-01-15 13:11:05,820][PID:833507][INFO][alembic.runtime.migration] Will assume transactional DDL. [2023-01-15 13:11:05,842][PID:833507][INFO][alembic.runtime.migration] Running stamp_revision -> fd4fc850d7ea 注:12-19行是我修改了bin/run 文件的代碼,打印臨時文件內容cat $TEMP_ENV_FILE輸出的; #查看初始化結果 (env_redash) [root@localhost log]# psql -h192.168.85.131 -Upostgres postgres=# \dtList of relationsSchema | Name | Type | Owner --------+---------------------------+-------+----------public | access_permissions | table | postgrespublic | alembic_version | table | postgrespublic | alert_subscriptions | table | postgrespublic | alerts | table | postgrespublic | api_keys | table | postgrespublic | changes | table | postgrespublic | dashboards | table | postgrespublic | data_source_groups | table | postgrespublic | data_sources | table | postgrespublic | events | table | postgrespublic | favorites | table | postgrespublic | groups | table | postgrespublic | notification_destinations | table | postgrespublic | organizations | table | postgrespublic | queries | table | postgrespublic | query_results | table | postgrespublic | query_snippets | table | postgrespublic | users | table | postgrespublic | visualizations | table | postgrespublic | widgets | table | postgres (20 rows)6.啟動
前端node server
npm run start 或 nohup npm run start </dev/null >out.log 2>&1 &后端flask server
./manage.py runserver --debugger --reload 或 #加載.env 環(huán)境變量 bin/run ./manage.py runserver --debugger --reload啟動worker
./manage.py rq worker啟動schedule
./manage.py rq scheduler參考
關鍵目錄
pip
/root/.pip
/root/.pip/pip.conf
postgres
/var/lib/pgsql/15/
/var/lib/pgsql/15/data/postgresql.conf
/var/lib/pgsql/15/data/log
redash
/var/tools/redash
/var/tools/redash/redash/settting/__init__.py
參考文章:
Redis & 集群安裝 https://zhuanlan.zhihu.com/p/57633787
python虛擬環(huán)境-virtualenv https://www.cnblogs.com/tian777/p/14946388.html
Python 掃盲https://blog.csdn.net/qxqxqzzz/article/details/47665553
Python.h: No such file or directory https://blog.csdn.net/tx1991427/article/details/126136676
Package.json 說明:https://blog.csdn.net/weixin_45626517/article/details/122820735
疑難問題:
Preparing metadata (setup.py) ... errorERROR: Command errored out with exit status 1:command: /var/tools/redash/redash-env/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ksb24he6/psycopg2_7bf87a09be7a46568623e974eaa10882/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ksb24he6/psycopg2_7bf87a09be7a46568623e974eaa10882/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-7lwoazqxcwd: /tmp/pip-install-ksb24he6/psycopg2_7bf87a09be7a46568623e974eaa10882/Complete output (23 lines):running egg_infocreating /tmp/pip-pip-egg-info-7lwoazqx/psycopg2.egg-infowriting /tmp/pip-pip-egg-info-7lwoazqx/psycopg2.egg-info/PKG-INFOwriting dependency_links to /tmp/pip-pip-egg-info-7lwoazqx/psycopg2.egg-info/dependency_links.txtwriting top-level names to /tmp/pip-pip-egg-info-7lwoazqx/psycopg2.egg-info/top_level.txtwriting manifest file '/tmp/pip-pip-egg-info-7lwoazqx/psycopg2.egg-info/SOURCES.txt'Error: pg_config executable not found.pg_config is required to build psycopg2 from source. Please add the directorycontaining pg_config to the $PATH or specify the full executable path with theoption:python setup.py build_ext --pg-config /path/to/pg_config build ...or with the pg_config option in 'setup.cfg'.If you prefer to avoid building psycopg2 from source, please install the PyPI'psycopg2-binary' package instead.For further information please check the 'doc/src/install.rst' file (also at<http://initd.org/psycopg/docs/install.html>).---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/5c/1c/6997288da181277a0c29bc39a5f9143ff20b8c99f2a7d059cfb55163e165/psycopg2-2.8.3.tar.gz#sha256=897a6e838319b4bf648a574afb6cabcb17d0488f8c7195100d48d872419f4457 (from https://pypi.org/simple/psycopg2/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement psycopg2==2.8.3 (from versions: 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.14, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.3.2, 2.4, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.5, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.5, 2.6, 2.6.1, 2.6.2, 2.7, 2.7.1, 2.7.2, 2.7.3, 2.7.3.1, 2.7.3.2, 2.7.4, 2.7.5, 2.7.6, 2.7.6.1, 2.7.7, 2.8, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.9, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 2.9.5) ERROR: No matching distribution found for psycopg2==2.8.3解決:
vi /etc/profile, 修改path
python -m pip install -r /var/tools/redash/requirements.txt,python下載文件后,setup時報錯
fatal error: Python.h: No such file or directory 解決: sudo yum install python3-develpython -m pip install -r /var/tools/redash/requirements_all_ds.txt 時報錯
/bin/sh: mysql_config: command not found 解決: sudo yum install mysql-devel輸出結果:... ...
(16/16): openssl-devel-1.1.1k-7.el8.x86_64.rpm 2.1 MB/s | 2.3 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.8 MB/s | 6.2 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : zlib-devel-1.2.11-20.el8.x86_64 1/16
Installing : pcre2-utf32-10.32-3.el8.x86_64 2/16
Installing : pcre2-utf16-10.32-3.el8.x86_64 3/16
Installing : pcre2-devel-10.32-3.el8.x86_64 4/16
Installing : libverto-devel-0.3.2-2.el8.x86_64 5/16
Installing : libsepol-devel-2.9-3.el8.x86_64 6/16
Installing : libselinux-devel-2.9-6.el8.x86_64 7/16
Installing : libkadm5-1.18.2-21.el8.x86_64 8/16
Installing : libcom_err-devel-1.45.6-5.el8.x86_64 9/16
Installing : keyutils-libs-devel-1.5.10-9.el8.x86_64 10/16
Installing : krb5-devel-1.18.2-21.el8.x86_64 11/16
Installing : openssl-devel-1:1.1.1k-7.el8.x86_64 12/16
Installing : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 13/16
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
Installing : mysql-common-8.0.26-1.module_el8.4.0+915+de215114.x86_64 14/16
Installing : mysql-libs-8.0.26-1.module_el8.4.0+915+de215114.x86_64 15/16
Installing : mysql-devel-8.0.26-1.module_el8.4.0+915+de215114.x86_64 16/16
Running scriptlet: mysql-devel-8.0.26-1.module_el8.4.0+915+de215114.x86_64 16/16
Verifying : mariadb-connector-c-config-3.1.11-2.el8_3.noarch 1/16
Verifying : mysql-common-8.0.26-1.module_el8.4.0+915+de215114.x86_64 2/16
Verifying : mysql-devel-8.0.26-1.module_el8.4.0+915+de215114.x86_64 3/16
Verifying : mysql-libs-8.0.26-1.module_el8.4.0+915+de215114.x86_64 4/16
Verifying : keyutils-libs-devel-1.5.10-9.el8.x86_64 5/16
Verifying : krb5-devel-1.18.2-21.el8.x86_64 6/16
Verifying : libcom_err-devel-1.45.6-5.el8.x86_64 7/16
Verifying : libkadm5-1.18.2-21.el8.x86_64 8/16
Verifying : libselinux-devel-2.9-6.el8.x86_64 9/16
Verifying : libsepol-devel-2.9-3.el8.x86_64 10/16
Verifying : libverto-devel-0.3.2-2.el8.x86_64 11/16
Verifying : openssl-devel-1:1.1.1k-7.el8.x86_64 12/16
Verifying : pcre2-devel-10.32-3.el8.x86_64 13/16
Verifying : pcre2-utf16-10.32-3.el8.x86_64 14/16
Verifying : pcre2-utf32-10.32-3.el8.x86_64 15/16
Verifying : zlib-devel-1.2.11-20.el8.x86_64 16/16
Installed:
keyutils-libs-devel-1.5.10-9.el8.x86_64 krb5-devel-1.18.2-21.el8.x86_64 libcom_err-devel-1.45.6-5.el8.x86_64
libkadm5-1.18.2-21.el8.x86_64 libselinux-devel-2.9-6.el8.x86_64 libsepol-devel-2.9-3.el8.x86_64
libverto-devel-0.3.2-2.el8.x86_64 mariadb-connector-c-config-3.1.11-2.el8_3.noarch mysql-common-8.0.26-1.module_el8.4.0+915+de215114.x86_64
mysql-devel-8.0.26-1.module_el8.4.0+915+de215114.x86_64 mysql-libs-8.0.26-1.module_el8.4.0+915+de215114.x86_64 openssl-devel-1:1.1.1k-7.el8.x86_64
pcre2-devel-10.32-3.el8.x86_64 pcre2-utf16-10.32-3.el8.x86_64 pcre2-utf32-10.32-3.el8.x86_64
zlib-devel-1.2.11-20.el8.x86_64
問題:npm ERR! Could not resolve dependency:
解決方法:增加參數(shù) --legacy-peer-deps,重新安裝
npm install --legacy-peer-deps(env_redash) [root@localhost redash]# npm installnpm notice
npm notice New major version of npm available! 8.19.2 -> 9.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.3.0
npm notice Run npm install -g npm@9.3.0npm notice Run npm install -g npm@9.3.0 to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: redash-client@11.0.0-dev
npm ERR! Found: axios@0.21.1
npm ERR! node_modules/axios
npm ERR! axios@"^0.21.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer axios@"~0.18.0 || ~0.19.1 || ~0.20.0" from axios-auth-refresh@3.0.0
npm ERR! node_modules/axios-auth-refresh
npm ERR! axios-auth-refresh@"^3.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-13T02_14_59_204Z-debug-0.log
問題:npm ERR! command git --no-replace-objects ls-remot
npm ERR! git@github.com: Permission denied (publickey).
解決:
此時!!!需要有一個github上的賬號(我用我的跟人帳號登錄)官網(wǎng):https://github.com/
首先,在命令行創(chuàng)建公密鑰,一路回車即可
ssh-keygen -t rsa cat /root/.ssh/id_rsa.pub #公鑰,將以下內容加入 github 的 key然后,登錄https://github.com/,界面選擇Settings --> SSH and GPG keys -->new SSH keys;
Title填入:自定義名稱 和 Key填入:你虛擬機上的 /root/.ssh/id_rsa.pub 的公鑰內容;保存即可。
code 128npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.comnpm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/getredash/sql-formatter.git
npm ERR! Warning: Permanently added 'github.comnpm ERR! Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
問題: idealTree:redash: sill idealTree buildDeps 卡住
分析:在用戶根目錄下的.npm/__catch__存在,清楚后重試
npm cache clean --force問題:sh: yarn: command not found
npm ERR! command sh -c -- cd viz-lib && yarn link --link-folder ../.yarn
分析:沒有安裝yarn
解決:
wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo yum -y install yarn yarn -v (env_redash) [root@localhost yum.repos.d]# yarn -v 1.22.19問題:
An unexpected error occurred: "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz: connect ECONNREFUSED 104.16.25.35:443
解決:
yarn config set registry http://registry.npm.taobao.org/yarn install v1.22.19[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz:error An unexpected error occurred: "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz: connect ECONNREFUSED 104.16.25.35:443".
info If you think this is a bug, please open a bug report with the information provided in "/var/tools/redash/viz-lib/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
npm ERR! code 1
npm ERR! path /var/tools/redash
npm ERR! command failed
npm ERR! command sh -c -- (cd viz-lib && yarn --frozen-lockfile && yarn build:babel) && yarn link --link-folder ./.yarn @redash/viz
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-01-13T04_31_07_103Z-debug-0.log
問題:
error redash-client@11.0.0-dev: The engine "node" is incompatible with this module. Expected version "^14.16.1"
... ..
error:0308010C:digital envelope routines::unsupported
分析:當前安裝的node版本是18,產生版本沖突,因為 node.js V17版本中最近發(fā)布的OpenSSL3.0, 而OpenSSL3.0對允許算法和密鑰大小增加了嚴格的限制
參考https://www.pudn.com/news/633d4b902aaf6043c9ecf2a2.html解決1:不卸載當前版本,增加設置,我選的方法
yarn config set ignore-engines true#臨時設置: export NODE_OPTIONS=--openssl-legacy-provider #永久設置: vi /etc/profile export NODE_OPTIONS="--openssl-legacy-provider" source /etc/profile解決2:重裝14.x或16.x,沒有實測過
root帳號運行:
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
問題:運行 bin/run ./manage.py check-settings,
報錯誤:ModuleNotFoundError: No module named 'pystache'
ModuleNotFoundError: No module named 'passlib'
分析:在配置python虛擬環(huán)境時,安裝requirement.txt引用的包時,注釋了pystache,passlib
解決:安裝
pip install pystache==0.5.4
pip install passlib==1.7.1
問題:安裝pystache,error in pystache setup command: use_2to3 is invalid.
分析:
后面看這個項目的描述,原來是一個中文分詞的庫,一開始是用C++寫的并提供給Ruby用的,后面作者又寫了python的接口,不過支持的版本一直在python 2.5+,于是在python3的版本進行安裝的時候,會在setuptools里的setup函數(shù)里增加一個use_2to3=True的參數(shù)進行轉換。
但是setuptools>=58的版本是不支持這個參數(shù)了(黑人問號),于是需要把版本降低,小于58的最后一個版本是57.5.0,pip降一下就可以了
解決:
pip install setuptools==57.5.0 pip install pystache==0.5.4問題:/var/py_virtual/env_redash/lib64/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
解決:
pip install psycopg2-binary==2.8.3問題:[HPM] Error occurred while trying to proxy request /login?next=/ from 192.168.85.131:8080 to http://localhost:5000/ (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
分析:這個問題困擾我整整兩天時間
原因是就是前端請求與后端服務監(jiān)聽的IP地址不一致,造成前端請求無法發(fā)送到爭取的IP地址和端口。
npm run start啟動之后,初始化的proxy target地址是localhost:5000
#webpack.config.js const redashBackend = process.env.REDASH_BACKEND || "http://localhost:5000"; 這里的localhost在執(zhí)行npm run start時,被初始化 如下面日志 ...... $ babel src --out-dir lib --source-maps --ignore 'src/**/*.test.js' --copy-files --no-copy-ignored --extensions .ts,.tsx,.js,.jsx --watch [HPM] Proxy created: ['/login','/logout','/invite','/setup','/status.json','/api','/oauth' ] -> http://localhost:5000/ [HPM] Proxy created: [Function: context] -> http://localhost:5000/ ... ...目前發(fā)現(xiàn),這個localhost只能通過2行的位置設置,設置環(huán)境變量.env中的REDASH_BACKEND,不起作用,原因待調查。在webpack runserver 時日志如下:
bin/run ./manage.py runserver --debugger --reload
(env_redash) [root@localhost redash]# bin/run ./manage.py runserver --debugger --reloadNUNBUFFERED="0"
export REDASH_LOG_LEVEL="INFO"
export REDASH_REDIS_URL="redis://localhost:6379/0"
POSTGRES_PASSWORD="Gao6584802"
export REDASH_COOKIE_SECRET="1d651e7057be0307a9ef8527c19ffec18f22de2ab5fdf2a71ff5ceda79abfec0"
export REDASH_SECRET_KEY="3fb8928e0314191a9177097d6578e6276159e9b267a4dca108dc550a6f89654f"
export REDASH_DATABASE_URL="postgresql://postgres:Gao6584802@192.168.85.131:5432/postgres"
export REDASH_BACKEND="http://192.168.85.131:5000"
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
[2023-01-15 19:17:13,289][PID:7314][INFO][werkzeug] * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2023-01-15 19:17:13,300][PID:7314][INFO][werkzeug] * Restarting with inotify reloader
[2023-01-15 19:17:15,178][PID:7324][WARNING][werkzeug] * Debugger is active!
[2023-01-15 19:17:15,178][PID:7324][INFO][werkzeug] * Debugger PIN: 284-487-444
日志中 http://127.0.0.1:5000/ 為后端請求的地址,啟動后,創(chuàng)建兩個進程:一個服務進程,一個debugger進程
netstat -tlunp #查看接口占用 Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 853/postmaster tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 7324/python tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 3089/redis-server * tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 845/sshd tcp6 0 0 :::5432 :::* LISTEN 853/postmaster tcp6 0 0 :::6379 :::* LISTEN 3089/redis-server * tcp6 0 0 :::22 :::* LISTEN 845/sshd udp 0 0 0.0.0.0:36241 0.0.0.0:* 5429/python udp 0 0 127.0.0.1:323 0.0.0.0:* 831/chronyd udp 0 0 0.0.0.0:42587 0.0.0.0:* 5388/python udp6 0 0 ::1:323 :::* 831/chronyd ps aux #查看具體執(zhí)行進程號對應的命令 root 7324 2.7 1.7 1169436 138972 pts/3 Sl 19:17 0:15 /var/py_virtual/env_redash/bin/python /var/tools/redash/manage.py runserver --debugger --reload從信息可以看出,服務監(jiān)聽的地址127.0.0.1 ,端口5000;而前端請求的地址是localhost,端口5000,但是linux解析localhost成IPV6,而不是127.0.0.1。造成前后端無法對齊。
解決:
修改webpack.config.js
.殺掉服務端進程包括8080端口、5000端口,然后重新運行npm run start,這時查看日志,地址已經改成127.0.0.1;
重新運行
bin/run ./manage.py runserver --debugger --reload
去瀏覽器請求8080端口,請求被正確轉發(fā)。但這時因為沒有登錄,頁面跳轉到127.0.0.1:5000/setup.因為我在另外ip地址訪問,造成頁面出錯
修改127.0.0.1 為192.168.85.131,順利進入setup頁面,問題解決
下面貼一張我在配置開發(fā)環(huán)境調通后的界面:username:407097480@qq.com;pass:redash
總結
以上是生活随笔為你收集整理的redash 在CentOS8环境部署(非docker)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MEC打通5G应用场景的“经络”
- 下一篇: 旅游风景区`web大作业 静态网页